pub struct Sha256;Expand description
SHA-256 hash function (32-byte output, FIPS 180-4 §6.2).
Implementations§
Source§impl Sha256
impl Sha256
Sourcepub const DIGEST_LEN: usize = 32
pub const DIGEST_LEN: usize = 32
Byte length of the SHA-256 digest output.
Sourcepub const OUTPUT_LEN: usize = 32
pub const OUTPUT_LEN: usize = 32
Output length in bytes (alias for DIGEST_LEN; use for generic const contexts).
Sourcepub const BLOCK_SIZE: usize = 64
pub const BLOCK_SIZE: usize = 64
SHA-256 block size in bytes (FIPS 180-4).
Source§impl Sha256
impl Sha256
Sourcepub fn hash_fixed(&self, msg: &[u8]) -> [u8; 32]
pub fn hash_fixed(&self, msg: &[u8]) -> [u8; 32]
Hash msg and return the 32-byte SHA-256 digest as a fixed-size array.
Alloc-free alternative to Hash::hash_to_vec.
§no_std note
When the no_std feature is enabled, prefer this method over
hash_to_vec, which requires heap allocation.
Trait Implementations§
impl Copy for Sha256
Source§impl Hash for Sha256
impl Hash for Sha256
Auto Trait Implementations§
impl Freeze for Sha256
impl RefUnwindSafe for Sha256
impl Send for Sha256
impl Sync for Sha256
impl Unpin for Sha256
impl UnsafeUnpin for Sha256
impl UnwindSafe for Sha256
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more