[][src]Trait tink_core::Prf

pub trait Prf: PrfBoxClone {
    fn compute_prf(
        &self,
        input: &[u8],
        output_length: usize
    ) -> Result<Vec<u8>, TinkError>; }

The Prf trait is an abstraction for an element of a pseudo random function family, selected by a key. It has the following property:

Required methods

fn compute_prf(
    &self,
    input: &[u8],
    output_length: usize
) -> Result<Vec<u8>, TinkError>

Compute the PRF selected by the underlying key on input and returns the first output_length bytes. When choosing this parameter keep the birthday paradox in mind. If you have 2^n different inputs that your system has to handle set the output length (in bytes) to at least ceil(n/4 + 4) This corresponds to 2*n + 32 bits, meaning a collision will occur with a probability less than 1:2^32. When in doubt, request a security review. Returns a non ok status if the algorithm fails or if the output of algorithm is less than outputLength.

Loading content...

Implementors

Loading content...