mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Merge remote-tracking branch 'catalyst-github/bug26415_034' into maint-0.3.4
This commit is contained in:
commit
ac1747e47f
3
changes/bug26415
Normal file
3
changes/bug26415
Normal file
@ -0,0 +1,3 @@
|
||||
o Minor bugfixes (testing):
|
||||
- Fix compilation of the doctests in the Rust crypto crate. Fixes
|
||||
bug 26415; bugfix on 0.3.4.1-alpha.
|
@ -44,9 +44,9 @@ pub struct Sha256 {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use crypto::digest::Sha256;
|
||||
/// use crypto::digests::sha2::{Sha256, Digest};
|
||||
///
|
||||
/// let hasher: Sha256 = Sha256::default();
|
||||
/// let mut hasher: Sha256 = Sha256::default();
|
||||
/// ```
|
||||
///
|
||||
/// # Returns
|
||||
@ -67,12 +67,12 @@ impl BlockInput for Sha256 {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use crypto::digest::Sha256;
|
||||
/// use crypto::digests::sha2::{Sha256, Digest};
|
||||
///
|
||||
/// let hasher: Sha256 = Sha256::default();
|
||||
/// let mut hasher: Sha256 = Sha256::default();
|
||||
///
|
||||
/// hasher.process(b"foo");
|
||||
/// hasher.process(b"bar");
|
||||
/// hasher.input(b"foo");
|
||||
/// hasher.input(b"bar");
|
||||
/// ```
|
||||
impl Input for Sha256 {
|
||||
fn process(&mut self, msg: &[u8]) {
|
||||
@ -111,9 +111,9 @@ pub struct Sha512 {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use crypto::digest::Sha512;
|
||||
/// use crypto::digests::sha2::{Sha512, Digest};
|
||||
///
|
||||
/// let hasher: Sha256 = Sha512::default();
|
||||
/// let mut hasher: Sha512 = Sha512::default();
|
||||
/// ```
|
||||
///
|
||||
/// # Returns
|
||||
@ -134,12 +134,12 @@ impl BlockInput for Sha512 {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use crypto::digest::Sha512;
|
||||
/// use crypto::digests::sha2::{Sha512, Digest};
|
||||
///
|
||||
/// let hasher: Sha512 = Sha512::default();
|
||||
/// let mut hasher: Sha512 = Sha512::default();
|
||||
///
|
||||
/// hasher.process(b"foo");
|
||||
/// hasher.process(b"bar");
|
||||
/// hasher.input(b"foo");
|
||||
/// hasher.input(b"bar");
|
||||
/// ```
|
||||
impl Input for Sha512 {
|
||||
fn process(&mut self, msg: &[u8]) {
|
||||
|
@ -10,18 +10,18 @@
|
||||
//! and extendable output functions.
|
||||
//!
|
||||
//! ```
|
||||
//! use crypto::digests::sha256::Sha256;
|
||||
//! use crypto::digests::sha2::*;
|
||||
//!
|
||||
//! let hasher: Sha256 = Sha256::default();
|
||||
//! let mut hasher: Sha256 = Sha256::default();
|
||||
//! let mut result: [u8; 32] = [0u8; 32];
|
||||
//!
|
||||
//! hasher.input("foo");
|
||||
//! hasher.input("bar");
|
||||
//! hasher.input("baz");
|
||||
//! hasher.input(b"foo");
|
||||
//! hasher.input(b"bar");
|
||||
//! hasher.input(b"baz");
|
||||
//!
|
||||
//! result.copy_from_slice(hasher.result().as_bytes());
|
||||
//! result.copy_from_slice(hasher.result().as_slice());
|
||||
//!
|
||||
//! assert!(result == "XXX");
|
||||
//! assert!(result == [b'X'; DIGEST256_LEN]);
|
||||
//! ```
|
||||
|
||||
#[deny(missing_docs)]
|
||||
|
Loading…
Reference in New Issue
Block a user