pub fn derive_key(
        message: &[u8],
        params: ConcatKDFParams<'_>,
        mut output: &mut [u8],
    ) -> Result<(), Error> {
        let output_len = output.len();
        if output_len > H::OutputSize::USIZE * (u32::MAX as usize) - 1 {
            return Err(err_msg!(Usage, "Exceeded max output size for concat KDF"));
        }
        let mut hasher = ConcatKDFHash::<H>::new();
        let mut remain = output_len;
        while remain > 0 {
            hasher.start_pass();
            hasher.hash_message(message);
            hasher.hash_params(params);
            let hashed = hasher.finish_pass();
            let cp_size = hashed.len().min(remain);
            output[..cp_size].copy_from_slice(&hashed[..cp_size]);
            output = &mut output[cp_size..];
            remain -= cp_size;
        }
        Ok(())
    }
/// Perform the key derivation and write the result to the provided buffer
Perform the key derivation and write the result to the provided buffer
Perform the key derivation and write the result to the provided buffer
pub fn derive_key(
        message: &[u8],
        params: ConcatKDFParams<'_>,
        mut output: &mut [u8],
    ) -> Result<(), Error> {
        let output_len = output.len();
        if output_len > H::OutputSize::USIZE * (u32::MAX as usize) - 1 {
            return Err(err_msg!(Usage, "Exceeded max output size for concat KDF"));
        }
        let mut hasher = ConcatKDFHash::<H>::new();
        let mut remain = output_len;
        while remain > 0 {
            hasher.start_pass();
            hasher.hash_message(message);
            hasher.hash_params(params);
            let hashed = hasher.finish_pass();
            let cp_size = hashed.len().min(remain);
            output[..cp_size].copy_from_slice(&hashed[..cp_size]);
            output = &mut output[cp_size..];
            remain -= cp_size;
        }
        Ok(())
    }
pub fn derive_key ( message : & [ u8 ] , params : ConcatKDFParams < ' _ > , mut output : & mut [ u8 ] , ) -> Result < ( ) , Error > { let output_len = output . len ( ) ; if output_len > H :: OutputSize :: USIZE * ( u32 :: MAX as usize ) - 1 { return Err ( err_msg ! ( Usage " " ) ) ; } let mut hasher = ConcatKDFHash :: < H > :: new ( ) ; let mut remain = output_len ; while remain > 0 { hasher . start_pass ( ) ; hasher . hash_message ( message ) ; hasher . hash_params ( params ) ; let hashed = hasher . finish_pass ( ) ; let cp_size = hashed . len ( ) . min ( remain ) ; output [ .. cp_size ] . copy_from_slice ( & hashed [ .. cp_size ] ) ; output = & mut output [ cp_size .. ] ; remain -= cp_size ; } Ok ( ( ) ) }
Perform the key derivation and write the result to the provided buffer
Perform the key derivation and write the result to the provided buffer
message
&[u8]
params
ConcatKDFParams<'_>
output
&mut [u8]