/// Generic PRF used for protocol specific PRF's.
Generic PRF used for protocol specific PRF's.
Generic PRF used for protocol specific PRF ' s .
fn prf(key: &[u8], bit1: bool, bit2: bool, seed: &[bool], personalisation: &[u8]) -> [u8; 32] {
    assert_eq!(key.len(), 32);
    assert_eq!(seed.len(), 254);
    assert_eq!(personalisation.len(), 8);
    *blake2s_simd::Params::new()
        .hash_length(32)
        .personal(personalisation)
        .to_state()
        .update(key)
        .update(
            &[bit1, bit2]
                .iter()
                .cloned()
                .chain(seed.iter().cloned())
                .collect::<BitVec>()
                .to_bytes(),
        )
        .finalize()
        .as_array()
}
fn prf ( key : & [ u8 ] , bit1 : bool , bit2 : bool , seed : & [ bool ] , personalisation : & [ u8 ] ) -> [ u8 ; 32 ] { assert_eq ! ( key len ( ) 32 ) ; assert_eq ! ( seed len ( ) 254 ) ; assert_eq ! ( personalisation len ( ) 8 ) ; * blake2s_simd :: Params :: new ( ) . hash_length ( 32 ) . personal ( personalisation ) . to_state ( ) . update ( key ) . update ( & [ bit1 , bit2 ] . iter ( ) . cloned ( ) . chain ( seed . iter ( ) . cloned ( ) ) . collect :: < BitVec > ( ) . to_bytes ( ) , ) . finalize ( ) . as_array ( ) }
Generic PRF used for protocol specific PRF's.
Generic PRF used for protocol specific PRF ' s .
key
&[u8]
bit1
bool
bit2
bool
seed
&[bool]
personalisation
&[u8]