[−][src]Struct lsx::sha256::RawSha256
A raw SHA-256 state. This does not include a buffer, so you must provide
data in exact increments of BLOCKBYTES
(64 bytes).
const DATA: &[u8] = b"Lorem ipsum dolor sit amet, consectetur adipisicing \ elit, sed do eiusmod tempor incididunt ut labore et \ dolore magna aliqua. Ut enim ad minim veniam, quis \ nostrud exercitation ullamco laboris nisi ut \ aliquip ex ea commodo consequat. Duis aute irure \ dolor in reprehenderit in voluptate velit esse \ cillum dolore eu fugiat nulla pariatur. Excepteur \ sint occaecat cupidatat non proident, sunt in culpa \ qui officia deserunt mollit anim id est laborum."; let mut hasher = RawSha256::new(); hasher.update(&DATA[.. sha256::BLOCKBYTES]); // you can provide more than one block (this next call provides two) hasher.update(&DATA[sha256::BLOCKBYTES .. sha256::BLOCKBYTES * 3]); // empty blocks have no effect hasher.update(&[]); // finish can handle more than one block if needed assert_eq!(hasher.finish(&DATA[sha256::BLOCKBYTES * 3 ..]), [0x2c,0x7c,0x3d,0x5f,0x24,0x4f,0x1a,0x40,0x06,0x9a,0x32,0x22, 0x42,0x15,0xe0,0xcf,0x9b,0x42,0x48,0x5c,0x99,0xd8,0x0f,0x35, 0x7d,0x76,0xf0,0x06,0x35,0x9c,0x7a,0x18]);
Implementations
impl RawSha256
[src]
pub fn new() -> RawSha256
[src]
Start a new hash.
pub fn update(&mut self, data: &[u8])
[src]
Process some blocks of data. Panics if the input is not an exact
multiple of BLOCKBYTES
(64 bytes).
pub fn finish(self, data: &[u8]) -> [u8; 32]
[src]
Process the remaining data and produce a finished hash. The input does
not need to be a multiple of BLOCKBYTES
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for RawSha256
impl Send for RawSha256
impl Sync for RawSha256
impl Unpin for RawSha256
impl UnwindSafe for RawSha256
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,