### RIPEMD Hashing Examples Source: https://docs.rs/ripemd/latest/ripemd/index.html?search= Examples demonstrating the usage of the RIPEMD-160 and RIPEMD-320 hashers from the ripemd crate. ```APIDOC ## Ripemd160::new() ### Description Creates a new RIPEMD-160 hasher instance. ### Method new ### Parameters None ### Returns A new `Ripemd160` hasher instance. ### Example ```rust use ripemd::{Ripemd160, Digest}; let mut hasher = Ripemd160::new(); ``` ``` ```APIDOC ## Ripemd160::update() ### Description Updates the hasher with input data. ### Method update ### Parameters - **data** (impl AsRef<[u8]>) - Required - The data to hash. ### Returns Nothing (unit type). ### Example ```rust use ripemd::{Ripemd160, Digest}; let mut hasher = Ripemd160::new(); hasher.update(b"Hello world!"); ``` ``` ```APIDOC ## Ripemd160::finalize() ### Description Finalizes the hashing process and returns the computed hash. ### Method finalize ### Parameters None ### Returns A `GenericArray` of bytes representing the hash. ### Example ```rust use ripemd::{Ripemd160, Digest}; use hex_literal::hex; let mut hasher = Ripemd160::new(); hasher.update(b"Hello world!"); let hash160 = hasher.finalize(); assert_eq!(hash160, hex!("7f772647d88750add82d8e1a7a3e5c0902a346a3")); ``` ``` ```APIDOC ## Ripemd320::new() ### Description Creates a new RIPEMD-320 hasher instance. ### Method new ### Parameters None ### Returns A new `Ripemd320` hasher instance. ### Example ```rust use ripemd::{Ripemd320, Digest}; let mut hasher = Ripemd320::new(); ``` ``` ```APIDOC ## Ripemd320::update() ### Description Updates the hasher with input data. ### Method update ### Parameters - **data** (impl AsRef<[u8]>) - Required - The data to hash. ### Returns Nothing (unit type). ### Example ```rust use ripemd::{Ripemd320, Digest}; let mut hasher = Ripemd320::new(); hasher.update(b"Hello world!"); ``` ``` ```APIDOC ## Ripemd320::finalize() ### Description Finalizes the hashing process and returns the computed hash. ### Method finalize ### Parameters None ### Returns A `GenericArray` of bytes representing the hash. ### Example ```rust use ripemd::{Ripemd320, Digest}; use hex_literal::hex; let mut hasher = Ripemd320::new(); hasher.update(b"Hello world!"); let hash320 = hasher.finalize(); assert_eq!(hash320, hex!("f1c1c231d301abcf2d7daae0269ff3e7bc68e623ad723aa068d316b056d26b7d1bb6f0cc0f28336d")); ``` ``` -------------------------------- ### DynDigest::output_size Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Gets the output size of the hasher in bytes using dynamic dispatch. ```APIDOC ## [FUNCTION] DynDigest::output_size ### Description Gets the output size of the hasher in bytes using dynamic dispatch. ### Method FUNCTION ### Signature ```rust fn output_size(&self) -> usize ``` ### Parameters None ### Returns - **usize** - The output size in bytes. ### Example ```rust let hasher: Box = Box::new(Ripemd160::new()); let size = hasher.output_size(); ``` ``` -------------------------------- ### TryInto::try_into Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html Performs the conversion. ```APIDOC ## TryInto::try_into ### Description Performs the conversion. ### Method fn try_into(self) -> Result>::Error> ### Parameters - **self** (T) - The value to convert into. ### Returns - **Result>::Error>** - The result of the conversion. ### Example ```rust let result: Result = 5u8.try_into(); ``` ``` -------------------------------- ### DynAssociatedOid::oid Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html Gets the OID associated with this value. ```APIDOC ## DynAssociatedOid::oid ### Description Gets the OID associated with this value. ### Method oid ### Signature ```rust pub fn oid(&self) -> ObjectIdentifier ``` ### Parameters None ### Returns - **ObjectIdentifier** - The OID associated with this value. ### Example ```rust use ripemd::Ripemd256; use digest::DynAssociatedOid; let hasher = Ripemd256::new(); let oid = hasher.oid(); ``` ``` -------------------------------- ### TryFrom::try_from Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html Performs the conversion. ```APIDOC ## TryFrom::try_from ### Description Performs the conversion. ### Method fn try_from(value: U) -> Result ### Parameters - **value** (U) - The value to convert from. ### Returns - **Result** - The result of the conversion. ### Example ```rust let result: Result = u32::try_from(5u8); ``` ``` -------------------------------- ### Digest::output_size Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Gets the output size of the hasher in bytes. ```APIDOC ## [FUNCTION] Digest::output_size ### Description Gets the output size of the hasher in bytes. ### Method FUNCTION ### Signature ```rust fn output_size() -> usize ``` ### Parameters None ### Returns - **usize** - The output size in bytes. ### Example ```rust let size = Ripemd160::output_size(); ``` ``` -------------------------------- ### Hash with Ripemd160 and Ripemd320 Source: https://docs.rs/ripemd/latest/ripemd/index.html?search=u32+-%3E+bool Demonstrates hashing the string "Hello world!" with RIPEMD-160 and RIPEMD-320 using the digest trait. The expected hashes are asserted with hex literals. Requires the `ripemd` and `hex-literal` crates. ```rust use ripemd::{Ripemd160, Ripemd320, Digest}; use hex_literal::hex; let mut hasher = Ripemd160::new(); hasher.update(b"Hello world!"); let hash160 = hasher.finalize(); assert_eq!(hash160, hex!("7f772647d88750add82d8e1a7a3e5c0902a346a3")); // Same example for RIPEMD-320 let mut hasher = Ripemd320::new(); hasher.update(b"Hello world!"); let hash320 = hasher.finalize(); assert_eq!(hash320, hex!( "f1c1c231d301abcf2d7daae0269ff3e7bc68e623" "ad723aa068d316b056d26b7d1bb6f0cc0f28336d" )); ``` -------------------------------- ### Ripemd320::new() Source: https://docs.rs/ripemd/latest/ripemd/index.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new RIPEMD-320 hasher instance. ```APIDOC ## [Rust] Ripemd320::new() ### Description Creates a new RIPEMD-320 hasher instance. ### Method new() ### Parameters None ### Returns Ripemd320 hasher instance ### Example ```rust use ripemd::{Ripemd320, Digest}; let mut hasher = Ripemd320::new(); hasher.update(b"Hello world!"); let hash = hasher.finalize(); ``` ``` -------------------------------- ### Into for Ripemd128 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Conversion methods from the standard library. ```APIDOC ## Into for Ripemd128 ### Description Provides conversion into a value. ### Method into ### Signature fn into(self) -> U ### Parameters - **self** (T) - The value to convert. ### Returns - **U** - The converted value. ### Description Calls `U::from(self)`. That is, this conversion is whatever the implementation of `From for U` chooses to do. ``` -------------------------------- ### From for Ripemd128 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Conversion methods from the standard library. ```APIDOC ## From for Ripemd128 ### Description Provides conversion from a value to itself. ### Method from ### Signature fn from(t: T) -> T ### Parameters - **t** (T) - The value to convert. ### Returns - **T** - The converted value. ### Description Returns the argument unchanged. ``` -------------------------------- ### Ripemd128::compose Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Creates a hasher from a core and buffer. ```APIDOC ## Compose ### Description Creates a hasher from a core and buffer. ### Method compose ### Signature pub fn compose(core: Self::Core, buffer: Buffer) -> Self ### Parameters - **core** (Self::Core) - Required - The core block-level type. - **buffer** (Buffer) - Required - The buffer. ### Returns Self - The composed hasher. ### Example ```rust use ripemd::Ripemd128; use digest::CoreProxy; let core = Ripemd128::Core::default(); let buffer = Default::default(); let hasher = Ripemd128::compose(core, buffer); ``` ``` -------------------------------- ### Ripemd160::new() Source: https://docs.rs/ripemd/latest/ripemd/index.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new RIPEMD-160 hasher instance. ```APIDOC ## [Rust] Ripemd160::new() ### Description Creates a new RIPEMD-160 hasher instance. ### Method new() ### Parameters None ### Returns Ripemd160 hasher instance ### Example ```rust use ripemd::{Ripemd160, Digest}; let mut hasher = Ripemd160::new(); hasher.update(b"Hello world!"); let hash = hasher.finalize(); ``` ``` -------------------------------- ### CloneToUninit for Ripemd128 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Unsafe cloning methods from the standard library. ```APIDOC ## CloneToUninit for Ripemd128 ### Description Provides unsafe cloning to uninitialized memory. ### Method clone_to_uninit ### Signature unsafe fn clone_to_uninit(&self, dest: *mut u8) ### Parameters - **dest** (*mut u8) - Pointer to the destination memory. ### Returns - () ### Description Performs copy-assignment from `self` to `dest`. This is a nightly-only experimental API. ``` -------------------------------- ### Ripemd320 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd320.html?search= Documentation for the Ripemd320 struct, including its methods and trait implementations. ```APIDOC ## Struct Ripemd320 ### Description RIPEMD-320 hasher. This struct implements the `Digest` trait and provides methods to update the hash state with data and finalize the hash computation. ### Methods #### `update` - **Signature**: `fn update(&mut self, data: &[u8])` - **Description**: Updates the hash state with the provided data. #### `finalize_fixed` - **Signature**: `fn finalize_fixed(self) -> Array` - **Description**: Retrieves the hash result and consumes the hasher instance. #### `finalize_into` - **Signature**: `fn finalize_into(self, out: &mut Output)` - **Description**: Consumes the hasher and writes the result into the provided output array. #### `finalize_fixed_reset` - **Signature**: `fn finalize_fixed_reset(&mut self) -> Array` - **Description**: Retrieves the hash result and resets the hasher state. #### `finalize_into_reset` - **Signature**: `fn finalize_into_reset(&mut self, out: &mut Output)` - **Description**: Writes the hash result into the provided array and resets the hasher state. #### `reset` - **Signature**: `fn reset(&mut self)` - **Description**: Resets the hasher state to its initial value. #### `chain` - **Signature**: `fn chain(self, data: impl AsRef<[u8]>) -> Self` - **Description**: Digests input data in a chained manner. #### `block_size` - **Signature**: `fn block_size() -> usize` - **Description**: Returns the block size in bytes. #### `output_size` - **Signature**: `fn output_size() -> usize` - **Description**: Returns the output size in bytes. #### `serialize` - **Signature**: `fn serialize(&self) -> SerializedState` - **Description**: Serializes and returns the internal state. #### `deserialize` - **Signature**: `fn deserialize(serialized_state: &SerializedState) -> Result` - **Description**: Creates an object from serialized internal state. ### Trait Implementations - `AlgorithmName`: Provides `write_alg_name` to write the algorithm name. - `BlockSizeUser`: Provides `BlockSize` type and `block_size` method. - `Clone`: Provides `clone` and `clone_from`. - `CoreProxy`: Provides `compose` and `decompose` for core and buffer management. - `Debug`: Provides `fmt` for formatting. - `Default`: Provides `default`. - `FixedOutput`: Provides `finalize_into` and `finalize_fixed`. - `FixedOutputReset`: Provides `finalize_into_reset` and `finalize_fixed_reset`. - `HashMarker`: Marker trait. - `OutputSizeUser`: Provides `OutputSize` type and `output_size` method. - `Reset`: Provides `reset`. - `SerializableState`: Provides `serialize` and `deserialize`. - `Update`: Provides `update` and `chain`. - `ZeroizeOnDrop`: Available on crate feature `zeroize` only. ### Example ```rust use ripemd::Ripemd320; use digest::Digest; let mut hasher = Ripemd320::new(); hasher.update(b"hello world"); let result = hasher.finalize(); ``` ``` -------------------------------- ### Borrow for Ripemd128 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Borrowing methods from the standard library. ```APIDOC ## Borrow for Ripemd128 ### Description Provides immutable borrowing of the value. ### Method borrow ### Signature fn borrow(&self) -> &T ### Parameters None ### Returns - **&T** - A reference to the borrowed value. ### Description Immutably borrows from an owned value. ``` -------------------------------- ### Ripemd256::compose Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html?search= Creates a hasher from a core and buffer. This is part of the CoreProxy trait. ```APIDOC ## [COMPOSE] Ripemd256::compose ### Description Creates a hasher from a core and buffer. This is part of the CoreProxy trait. ### Method COMPOSE ### Endpoint Ripemd256::compose ### Parameters #### Arguments - **core** (Self::Core) - Required - The core block-level type. - **buffer** (Buffer) - Required - The buffer. ### Request Example ```rust let core = Ripemd256Core::default(); let buffer = Buffer::default(); let hasher = Ripemd256::compose(core, buffer); ``` ### Response #### Success Response Returns a `Self` instance. ``` -------------------------------- ### Digest::new Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Creates a new hasher instance for Ripemd160. ```APIDOC ## [FUNCTION] Digest::new ### Description Creates a new hasher instance for the Ripemd160 hash algorithm. ### Method FUNCTION ### Signature ```rust fn new() -> D ``` ### Parameters None ### Returns - **D** (Ripemd160) - A new hasher instance. ### Example ```rust let mut hasher = Ripemd160::new(); ``` ``` -------------------------------- ### Ripemd256 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html?search=std%3A%3Avec Documentation for the Ripemd256 struct and its trait implementations. ```APIDOC ## Struct Ripemd256 ### Description RIPEMD-256 hasher. ### Trait Implementations #### AlgorithmName - `write_alg_name(f: &mut Formatter<'_>) -> Result<(), Error>` - Write algorithm name into `f`. #### AssociatedOid (feature `oid`) - `const OID: ObjectIdentifier` - The OID associated with this type. #### BlockSizeUser - `type BlockSize = ::BlockSize` - Size of the block in bytes. - `fn block_size() -> usize` - Return block size in bytes. #### Clone - `fn clone(&self) -> Self` - Returns a duplicate of the value. - `fn clone_from(&mut self, source: &Self)` - Performs copy-assignment from `source`. #### CoreProxy - `type Core = Ripemd256Core` - Core block-level type. - `fn compose(core: Self::Core, buffer: Buffer) -> Self` - Create `Self` from core and buffer. - `fn decompose(self) -> (Self::Core, Buffer)` - Decompose `self` into core and buffer. #### Debug - `fn fmt(&self, f: &mut Formatter<'_>) -> Result` - Formats the value using the given formatter. #### Default - `fn default() -> Self` - Returns the “default value” for a type. #### FixedOutput - `fn finalize_into(self, out: &mut Output)` - Consume value and write result into provided array. - `fn finalize_fixed(self) -> Array` - Retrieve result and consume the hasher instance. #### FixedOutputReset - `fn finalize_into_reset(&mut self, out: &mut Output)` - Write result into provided array and reset the hasher state. - `fn finalize_fixed_reset(&mut self) -> Array` - Retrieve result and reset the hasher state. #### HashMarker - Marker trait for hash types. #### OutputSizeUser - `type OutputSize = ::OutputSize` - Size of the output in bytes. - `fn output_size() -> usize` - Return output size in bytes. #### Reset - `fn reset(&mut self)` - Reset state to its initial value. #### SerializableState - `type SerializedStateSize` - Size of serialized internal state. - `fn serialize(&self) -> SerializedState` - Serialize and return internal state. - `fn deserialize(serialized_state: &SerializedState) -> Result` - Create an object from serialized internal state. #### Update - `fn update(&mut self, data: &[u8])` - Update state using the provided data. - `fn chain(self, data: impl AsRef<[u8]>) -> Self` where `Self: Sized` - Digest input data in a chained manner. #### ZeroizeOnDrop (feature `zeroize`) - Trait to zeroize on drop. ``` -------------------------------- ### Ripemd128::clone_from Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Performs copy-assignment from the source hasher. ```APIDOC ## Clone From ### Description Performs copy-assignment from the source hasher. ### Method clone_from ### Signature pub fn clone_from(&mut self, source: &Self) ### Parameters - **source** (&Self) - Required - The source hasher. ### Returns () ### Example ```rust use ripemd::Ripemd128; let mut hasher = Ripemd128::new(); let other = Ripemd128::new(); hasher.clone_from(&other); ``` ``` -------------------------------- ### Digest::new_with_prefix Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Creates a new hasher instance that has already processed the provided data. ```APIDOC ## [FUNCTION] Digest::new_with_prefix ### Description Creates a new hasher instance which has processed the provided data. ### Method FUNCTION ### Signature ```rust fn new_with_prefix(data: impl AsRef<[u8]>) -> D ``` ### Parameters - **data** (impl AsRef<[u8]>) - Required - The initial data to process. ### Returns - **D** (Ripemd160) - A new hasher instance with the data already processed. ### Example ```rust let hasher = Ripemd160::new_with_prefix(b"hello"); ``` ``` -------------------------------- ### Digest::new Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html Creates a new hasher instance for Ripemd256. ```APIDOC ## Digest::new ### Description Creates a new hasher instance for the Ripemd256 hash algorithm. ### Method new ### Signature ```rust pub fn new() -> D ``` ### Parameters None ### Returns - **D** - A new hasher instance. ### Example ```rust use ripemd::Ripemd256; use digest::Digest; let mut hasher = Ripemd256::new(); ``` ``` -------------------------------- ### BorrowMut for Ripemd128 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Mutable borrowing methods from the standard library. ```APIDOC ## BorrowMut for Ripemd128 ### Description Provides mutable borrowing of the value. ### Method borrow_mut ### Signature fn borrow_mut(&mut self) -> &mut T ### Parameters None ### Returns - **&mut T** - A mutable reference to the borrowed value. ### Description Mutably borrows from an owned value. ``` -------------------------------- ### Ripemd128::fmt Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Formats the value using the given formatter. ```APIDOC ## Debug Format ### Description Formats the value using the given formatter. ### Method fmt ### Signature pub fn fmt(&self, f: &mut Formatter<'_>) -> Result ### Parameters - **f** (&mut Formatter<'_>) - Required - The formatter. ### Returns Result - The formatting result. ### Example ```rust use ripemd::Ripemd128; let hasher = Ripemd128::new(); println!("{:?}", hasher); ``` ``` -------------------------------- ### Ripemd128::decompose Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Decomposes the hasher into core and buffer. ```APIDOC ## Decompose ### Description Decomposes the hasher into core and buffer. ### Method decompose ### Signature pub fn decompose(self) -> (Self::Core, Buffer) ### Parameters None ### Returns (Self::Core, Buffer) - The core and buffer. ### Example ```rust use ripemd::Ripemd128; use digest::CoreProxy; let hasher = Ripemd128::new(); let (core, buffer) = hasher.decompose(); ``` ``` -------------------------------- ### Ripemd256::clone_from Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html?search= Performs copy-assignment from `source`. This is part of the Clone trait. ```APIDOC ## [CLONE_FROM] Ripemd256::clone_from ### Description Performs copy-assignment from `source`. This is part of the Clone trait. ### Method CLONE_FROM ### Endpoint Ripemd256::clone_from ### Parameters #### Arguments - **source** (&Self) - Required - The source value to clone from. ### Request Example ```rust let mut hasher = Ripemd256::new(); let source = Ripemd256::new(); hasher.clone_from(&source); ``` ### Response #### Success Response No return value; modifies `self`. ``` -------------------------------- ### Ripemd320::update Source: https://docs.rs/ripemd/latest/ripemd/index.html Updates the hasher with input data. ```APIDOC ## [Ripemd320::update] Update data ### Description Updates the hasher with input data. ### Method update ### Endpoint Ripemd320::update ### Parameters #### Request Body - **data** (bytes) - Required - The data to hash. ### Request Example ```rust hasher.update(b"Hello world!"); ``` ### Response #### Success Response No return value. ``` -------------------------------- ### Ripemd160::clone_from Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=u32+-%3E+bool Performs copy-assignment from `source`. This method is part of the Clone trait. ```APIDOC ## Ripemd160::clone_from ### Description Performs copy-assignment from `source`. This method is part of the Clone trait. ### Method `fn clone_from(&mut self, source: &Self)` ### Parameters - **source** (`&Self`) - Required - The source value to copy from. ### Returns - `()` - No return value. ### Example ```rust let mut hasher = Ripemd160::new(); hasher.clone_from(&other); ``` ``` -------------------------------- ### Ripemd128::deserialize Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Creates a hasher from serialized internal state. ```APIDOC ## Deserialize ### Description Creates a hasher from serialized internal state. ### Method deserialize ### Signature pub fn deserialize(serialized_state: &SerializedState) -> Result ### Parameters - **serialized_state** (&SerializedState) - Required - The serialized state. ### Returns Result - The deserialized hasher or an error. ### Example ```rust use ripemd::Ripemd128; use digest::SerializableState; let hasher = Ripemd128::new(); let state = hasher.serialize(); let restored = Ripemd128::deserialize(&state).unwrap(); ``` ``` -------------------------------- ### Ripemd128::finalize_into Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Consumes the hasher and writes the result into the provided output array. ```APIDOC ## Finalize Into ### Description Consumes the hasher and writes the result into the provided output array. ### Method finalize_into ### Signature pub fn finalize_into(self, out: &mut Output) ### Parameters - **out** (&mut Output) - Required - The output array to write the hash into. ### Returns () ### Example ```rust use ripemd::Ripemd128; use digest::{Update, FixedOutput}; let mut hasher = Ripemd128::new(); hasher.update(b"hello"); let mut output = [0u8; 16]; hasher.finalize_into(&mut output.into()); ``` ``` -------------------------------- ### Ripemd256::fmt Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html?search= Formats the value using the given formatter. This is part of the Debug trait. ```APIDOC ## [FMT] Ripemd256::fmt ### Description Formats the value using the given formatter. This is part of the Debug trait. ### Method FMT ### Endpoint Ripemd256::fmt ### Parameters #### Arguments - **f** (&mut Formatter<'_>) - Required - The formatter. ### Request Example ```rust let hasher = Ripemd256::new(); println!("{:?}", hasher); ``` ### Response #### Success Response Returns `Result` indicating success or failure. ``` -------------------------------- ### TryInto::try_into Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Performs the conversion from a value of type self to a value of type U. ```APIDOC ## TryInto::try_into ### Description Performs the conversion from a value of type self to a value of type U. ### Method fn try_into(self) -> Result>::Error> ### Parameters - **self** (Self) - The value to convert. ### Returns - **Result>::Error>** - The result of the conversion, which is either Ok(U) or Err containing the conversion error. ``` -------------------------------- ### Ripemd128::output_size Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Returns the output size in bytes. ```APIDOC ## Output Size ### Description Returns the output size in bytes. ### Method output_size ### Signature pub fn output_size() -> usize ### Parameters None ### Returns usize - The output size in bytes. ### Example ```rust use ripemd::Ripemd128; use digest::OutputSizeUser; let size = Ripemd128::output_size(); ``` ``` -------------------------------- ### Trait Digest Source: https://docs.rs/ripemd/latest/ripemd/trait.Digest.html Documentation for the Digest trait, including its required methods, dyn compatibility, and implementors. ```APIDOC ## Trait Digest ### Description Convenience wrapper trait covering functionality of cryptographic hash functions with fixed output size. This trait wraps `Update`, `FixedOutput`, `Default`, and `HashMarker` traits and provides additional convenience methods. ### Required Methods #### `fn new() -> Self` Create new hasher instance. #### `fn new_with_prefix(data: impl AsRef<[u8]>) -> Self` Create new hasher instance which has processed the provided data. #### `fn update(&mut self, data: impl AsRef<[u8]>)` Process data, updating the internal state. #### `fn chain_update(self, data: impl AsRef<[u8]>) -> Self` Process input data in a chained manner. #### `fn finalize(self) -> Array` Retrieve result and consume hasher instance. #### `fn finalize_into(self, out: &mut Array)` Write result into provided array and consume the hasher instance. #### `fn finalize_reset(&mut self) -> Array` where `Self: FixedOutputReset` Retrieve result and reset hasher instance. #### `fn finalize_into_reset(&mut self, out: &mut Array)` where `Self: FixedOutputReset` Write result into provided array and reset the hasher instance. #### `fn reset(&mut self)` where `Self: Reset` Reset hasher instance to its initial state. #### `fn output_size() -> usize` Get output size of the hasher. #### `fn digest(data: impl AsRef<[u8]>) -> Array` Compute hash of `data`. ### Dyn Compatibility This trait is **not** dyn compatible. In older versions of Rust, dyn compatibility was called "object safety". ### Implementors `impl Digest for D` where `D: FixedOutput + Default + Update + HashMarker`. ``` -------------------------------- ### impl TryInto for T where U: TryFrom Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Provides the TryInto trait implementation for converting from type T to type U, where U can be converted from T. ```APIDOC ## impl TryInto for T where U: TryFrom ### Description Provides the TryInto trait implementation for converting from type T to type U, where U can be converted from T. ### Associated Types - **Error** (`>::Error`) - The type returned in the event of a conversion error. ### Methods #### `fn try_into(self) -> Result>::Error>` Performs the conversion. ``` -------------------------------- ### Ripemd128::serialize Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Serializes the internal state of the hasher. ```APIDOC ## Serialize ### Description Serializes the internal state of the hasher. ### Method serialize ### Signature pub fn serialize(&self) -> SerializedState ### Parameters None ### Returns SerializedState - The serialized state. ### Example ```rust use ripemd::Ripemd128; use digest::SerializableState; let hasher = Ripemd128::new(); let state = hasher.serialize(); ``` ``` -------------------------------- ### impl TryFrom for T where U: Into Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Provides the TryFrom trait implementation for converting from type U to type T, where U can be converted into T. ```APIDOC ## impl TryFrom for T where U: Into ### Description Provides the TryFrom trait implementation for converting from type U to type T, where U can be converted into T. ### Associated Types - **Error** (`!`) - The type returned in the event of a conversion error. ### Methods #### `fn try_from(value: U) -> Result` Performs the conversion. ``` -------------------------------- ### Ripemd160::update Source: https://docs.rs/ripemd/latest/ripemd/index.html Updates the hasher with input data. ```APIDOC ## [Ripemd160::update] Update data ### Description Updates the hasher with input data. ### Method update ### Endpoint Ripemd160::update ### Parameters #### Request Body - **data** (bytes) - Required - The data to hash. ### Request Example ```rust hasher.update(b"Hello world!"); ``` ### Response #### Success Response No return value. ``` -------------------------------- ### Ripemd128::default Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Returns the default value for the type. ```APIDOC ## Default ### Description Returns the default value for the type. ### Method default ### Signature pub fn default() -> Self ### Parameters None ### Returns Self - The default hasher. ### Example ```rust use ripemd::Ripemd128; let hasher = Ripemd128::default(); ``` ``` -------------------------------- ### DynDigest::finalize_into Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Writes the hash result into a provided buffer and consumes the hasher instance using dynamic dispatch. ```APIDOC ## [FUNCTION] DynDigest::finalize_into ### Description Writes the hash result into a provided buffer and consumes the hasher instance using dynamic dispatch. ### Method FUNCTION ### Signature ```rust fn finalize_into(self, buf: &mut [u8]) -> Result<(), InvalidBufferSize> ``` ### Parameters - **buf** (&mut [u8]) - Required - The buffer to write the hash into. ### Returns - **Result<(), InvalidBufferSize>** - Ok if the buffer size matches the output size, otherwise an error. ### Example ```rust let hasher: Box = Box::new(Ripemd160::new()); let mut buf = [0u8; 20]; let result = hasher.finalize_into(&mut buf); ``` ``` -------------------------------- ### Ripemd128::clone Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Returns a duplicate of the value. ```APIDOC ## Clone ### Description Returns a duplicate of the value. ### Method clone ### Signature pub fn clone(&self) -> Self ### Parameters None ### Returns Self - A clone of the hasher. ### Example ```rust use ripemd::Ripemd128; let hasher = Ripemd128::new(); let clone = hasher.clone(); ``` ``` -------------------------------- ### Ripemd320::finalize Source: https://docs.rs/ripemd/latest/ripemd/index.html Finalizes the hasher and returns the computed hash. ```APIDOC ## [Ripemd320::finalize] Finalize hash ### Description Finalizes the hasher and returns the computed hash. ### Method finalize ### Endpoint Ripemd320::finalize ### Parameters None ### Request Example ```rust let hash320 = hasher.finalize(); ``` ### Response #### Success Response - **hash** (array) - The computed hash. #### Response Example ```rust assert_eq!(hash320, hex!("f1c1c231d301abcf2d7daae0269ff3e7bc68e623ad723aa068d316b056d26b7d1bb6f0cc0f28336d")); ``` ``` -------------------------------- ### ToOwned::clone_into Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Uses borrowed data to replace owned data, usually by cloning. ```APIDOC ## ToOwned::clone_into ### Description Uses borrowed data to replace owned data, usually by cloning. ### Method fn clone_into(&self, target: &mut T) ### Parameters - **self** (&Self) - The borrowed data to clone. - **target** (&mut T) - The mutable reference to the owned data to be replaced. ### Returns - **()** - This method does not return a value; it modifies the target in place. ``` -------------------------------- ### TryFrom::try_from Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Performs the conversion from a value of type U to a value of type T. ```APIDOC ## TryFrom::try_from ### Description Performs the conversion from a value of type U to a value of type T. ### Method fn try_from(value: U) -> Result ### Parameters - **value** (U) - The value to convert. ### Returns - **Result** - The result of the conversion, which is always Ok(T) because the error type is the never type. ``` -------------------------------- ### Ripemd128::write_alg_name Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Writes the algorithm name into the provided formatter. ```APIDOC ## Write Algorithm Name ### Description Writes the algorithm name into the provided formatter. ### Method write_alg_name ### Signature pub fn write_alg_name(f: &mut Formatter<'_>) -> Result<(), Error> ### Parameters - **f** (&mut Formatter<'_>) - Required - The formatter to write the name into. ### Returns Result<(), Error> - Ok if successful, or an error. ### Example ```rust use ripemd::Ripemd128; use digest::AlgorithmName; use std::fmt::Write; let mut s = String::new(); Ripemd128::write_alg_name(&mut s).unwrap(); ``` ``` -------------------------------- ### Ripemd256::decompose Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd256.html?search= Decomposes the hasher into core and buffer. This is part of the CoreProxy trait. ```APIDOC ## [DECOMPOSE] Ripemd256::decompose ### Description Decomposes the hasher into core and buffer. This is part of the CoreProxy trait. ### Method DECOMPOSE ### Endpoint Ripemd256::decompose ### Parameters None. ### Request Example ```rust let (core, buffer) = hasher.decompose(); ``` ### Response #### Success Response Returns a tuple `(Self::Core, Buffer)`. ``` -------------------------------- ### DynDigest::finalize_into_reset Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search=std%3A%3Avec Writes the hash result into a provided buffer and resets the hasher instance using dynamic dispatch. ```APIDOC ## [FUNCTION] DynDigest::finalize_into_reset ### Description Writes the hash result into a provided buffer and resets the hasher instance using dynamic dispatch. ### Method FUNCTION ### Signature ```rust fn finalize_into_reset(&mut self, buf: &mut [u8]) -> Result<(), InvalidBufferSize> ``` ### Parameters - **buf** (&mut [u8]) - Required - The buffer to write the hash into. ### Returns - **Result<(), InvalidBufferSize>** - Ok if the buffer size matches the output size, otherwise an error. ### Example ```rust let mut hasher: Box = Box::new(Ripemd160::new()); let mut buf = [0u8; 20]; let result = hasher.finalize_into_reset(&mut buf); ``` ``` -------------------------------- ### Ripemd320 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd320.html?search=std%3A%3Avec RIPEMD-320 hasher struct. Provides methods for updating, finalizing, resetting, and serializing the hasher state. ```APIDOC ## Struct Ripemd320 ### Description RIPEMD-320 hasher. This struct implements the RIPEMD-320 hashing algorithm and provides methods for incremental hashing, finalization, reset, and state serialization. ### Methods #### update(&mut self, data: &[u8]) Update state using the provided data. #### chain(self, data: impl AsRef<[u8]>) -> Self Digest input data in a chained manner. #### finalize_into(self, out: &mut Output) Consume value and write result into provided array. #### finalize_fixed(self) -> Array Retrieve result and consume the hasher instance. #### finalize_into_reset(&mut self, out: &mut Output) Write result into provided array and reset the hasher state. #### finalize_fixed_reset(&mut self) -> Array Retrieve result and reset the hasher state. #### reset(&mut self) Reset state to its initial value. #### serialize(&self) -> SerializedState Serialize and return internal state. #### deserialize(serialized_state: &SerializedState) -> Result Create an object from serialized internal state. ### Associated Types - `BlockSize` = `::BlockSize` - Size of the block in bytes. - `OutputSize` = `::OutputSize` - Size of the output in bytes. - `Core` = `Ripemd320Core` - Core block-level type. - `SerializedStateSize` = `<::SerializedStateSize as Add<<::BlockSize as Add<<::BufferKind as Sealed>::Overhead>>::Output>>::Output` - Size of serialized internal state. ### Trait Implementations - `AlgorithmName` - Write algorithm name into `f`. - `BlockSizeUser` - Provides block size. - `Clone` - Duplicates the value. - `CoreProxy` - Compose and decompose core and buffer. - `Debug` - Formats the value. - `Default` - Returns default value. - `FixedOutput` - Finalizes hashing. - `FixedOutputReset` - Finalizes and resets. - `HashMarker` - Marker trait. - `OutputSizeUser` - Provides output size. - `Reset` - Resets state. - `SerializableState` - Serializes and deserializes state. - `Update` - Updates state with data. - `ZeroizeOnDrop` - Available on crate feature `zeroize` only. ``` -------------------------------- ### Ripemd160 Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd160.html?search= RIPEMD-160 hasher. Provides methods for updating, finalizing, resetting, and serializing the hasher state. ```APIDOC ## Struct Ripemd160 ### Description RIPEMD-160 hasher. ### Methods #### update - **Signature**: `fn update(&mut self, data: &[u8])` - **Description**: Update state using the provided data. #### chain - **Signature**: `fn chain(self, data: impl AsRef<[u8]>) -> Self` where Self: Sized - **Description**: Digest input data in a chained manner. #### finalize_into - **Signature**: `fn finalize_into(self, out: &mut Output)` - **Description**: Consume value and write result into provided array. #### finalize_fixed - **Signature**: `fn finalize_fixed(self) -> Array` - **Description**: Retrieve result and consume the hasher instance. #### finalize_into_reset - **Signature**: `fn finalize_into_reset(&mut self, out: &mut Output)` - **Description**: Write result into provided array and reset the hasher state. #### finalize_fixed_reset - **Signature**: `fn finalize_fixed_reset(&mut self) -> Array` - **Description**: Retrieve result and reset the hasher state. #### reset - **Signature**: `fn reset(&mut self)` - **Description**: Reset state to its initial value. #### serialize - **Signature**: `fn serialize(&self) -> SerializedState` - **Description**: Serialize and return internal state. #### deserialize - **Signature**: `fn deserialize(serialized_state: &SerializedState) -> Result` - **Description**: Create an object from serialized internal state. #### block_size - **Signature**: `fn block_size() -> usize` - **Description**: Return block size in bytes. #### output_size - **Signature**: `fn output_size() -> usize` - **Description**: Return output size in bytes. #### write_alg_name - **Signature**: `fn write_alg_name(f: &mut Formatter<'_>) -> Result<(), Error>` - **Description**: Write algorithm name into `f`. ### Associated Constants #### OID - **Type**: `ObjectIdentifier` - **Description**: The OID associated with this type. Available on crate feature `oid` only. ### Associated Types #### BlockSize - **Type**: `::BlockSize` - **Description**: Size of the block in bytes. #### Core - **Type**: `Ripemd160Core` - **Description**: Core block-level type. #### OutputSize - **Type**: `::OutputSize` - **Description**: Size of the output in bytes. #### SerializedStateSize - **Type**: `<::SerializedStateSize as Add<<::BlockSize as Add<<::BufferKind as Sealed>::Overhead>>::Output>>::Output` - **Description**: Size of serialized internal state. ### Trait Implementations - `AlgorithmName` - `AssociatedOid` (requires crate feature `oid`) - `BlockSizeUser` - `Clone` - `CoreProxy` - `Debug` - `Default` - `FixedOutput` - `FixedOutputReset` - `HashMarker` - `OutputSizeUser` - `Reset` - `SerializableState` - `Update` - `ZeroizeOnDrop` (requires crate feature `zeroize`) ``` -------------------------------- ### Ripemd128::finalize_fixed Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd128.html Retrieves the hash result and consumes the hasher instance. ```APIDOC ## Finalize Fixed ### Description Retrieves the hash result and consumes the hasher instance. ### Method finalize_fixed ### Signature pub fn finalize_fixed(self) -> Array ### Parameters None ### Returns Array - The hash output. ### Example ```rust use ripemd::Ripemd128; use digest::{Update, FixedOutput}; let mut hasher = Ripemd128::new(); hasher.update(b"hello"); let result = hasher.finalize_fixed(); ``` ``` -------------------------------- ### Ripemd320::finalize_into Source: https://docs.rs/ripemd/latest/ripemd/struct.Ripemd320.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Consumes the hasher and writes the result into the provided output array. This method is part of the FixedOutput trait. ```APIDOC ## finalize_into ### Description Consumes the hasher and writes the result into the provided output array. ### Method `fn finalize_into(self, out: &mut Output)` ### Parameters - **out** (`&mut Output`) - The output buffer to write the hash into. ### Returns Nothing (unit type). ```