[−][src]Module orion::hazardous::hash::sha512
SHA512 as specified in the FIPS PUB 180-4.
Parameters:
data
: The data to be hashed.
Errors:
An error will be returned if:
finalize()
is called twice without areset()
in between.update()
is called afterfinalize()
without areset()
in between.
Panics:
A panic will occur if:
- More than 2*(2^64-1) bits of data are hashed.
Security:
- SHA512 is vulnerable to length extension attacks.
Recommendation:
- It is recommended to use BLAKE2b when possible.
Example:
use orion::hazardous::hash::sha512::Sha512; // Using the streaming interface let mut state = Sha512::new(); state.update(b"Hello world")?; let hash = state.finalize()?; // Using the one-shot function let hash_one_shot = Sha512::digest(b"Hello world")?; assert_eq!(hash, hash_one_shot);
Structs
Digest | A type to represent the |
Sha512 | SHA512 streaming state. |
Constants
SHA512_BLOCKSIZE | The blocksize for the hash function SHA512. |
SHA512_OUTSIZE | The output size for the hash function SHA512. |