Crate sha2
An implementation of the SHA-2 cryptographic hash algorithms.
There are 6 standard algorithms specified in the SHA-2 standard: Sha224,
Sha256, Sha512_224, Sha512_256, Sha384, and Sha512.
Algorithmically, there are only 2 core algorithms: SHA-256 and SHA-512. All other algorithms are just applications of these with different initial hash values, and truncated to different digest bit lengths. The first two algorithms in the list are based on SHA-256, while the last four are based on SHA-512.
Usage
use hex;
use ;
// create a Sha256 object
let mut hasher = new;
// write input message
hasher.update;
// read hash digest and consume hasher
let result = hasher.finalize;
assert_eq!;
// same for Sha512
let mut hasher = new;
hasher.update;
let result = hasher.finalize;
assert_eq!;
Also see RustCrypto/hashes readme.
Modules
Structs
- Sha256VarCore Core block-level SHA-256 hasher with variable output size.
- Sha512VarCore Core block-level SHA-512 hasher with variable output size.
Traits
Type Aliases
- Sha224 SHA-224 hasher.
- Sha256 SHA-256 hasher.
- Sha384 SHA-384 hasher.
- Sha512 SHA-512 hasher.
- Sha512_224 SHA-512/224 hasher.
- Sha512_256 SHA-512/256 hasher.