fn blind<CS: CipherSuite, R: RngCore + CryptoRng>(
    rng: &mut R,
    password: &[u8],
) -> Result<
    voprf::NonVerifiableClientBlindResult<CS::OprfGroup, CS::Hash>,
    voprf::errors::InternalError,
> {
    #[cfg(not(test))]
    let result = voprf::NonVerifiableClient::blind(password.to_vec(), rng)?;

    #[cfg(test)]
    let result = {
        let mut blind_bytes = vec![0u8; <CS::OprfGroup as Group>::ScalarLen::USIZE];
        let blind = loop {
            rng.fill_bytes(&mut blind_bytes);
            let scalar = <CS::OprfGroup as Group>::from_scalar_slice_unchecked(
                &GenericArray::clone_from_slice(&blind_bytes),
            )?;
            match scalar
                .ct_eq(&<CS::OprfGroup as Group>::scalar_zero())
                .into()
            {
                false => break scalar,
                true => (),
            }
        };
        voprf::NonVerifiableClient::deterministic_blind_unchecked(password.to_vec(), blind)?
    };

    Ok(result)
}
/// Internal function for computing the blind result by calling the
/// voprf library. Note that for tests, we use the deterministic blinding
/// in order to be able to set the blinding factor directly from the passed-in
/// rng.
Internal function for computing the blind result by calling the
voprf library. Note that for tests, we use the deterministic blinding
in order to be able to set the blinding factor directly from the passed-in
rng.
Internal function for computing the blind result by calling the voprf library . Note that for tests we use the deterministic blinding in order to be able to set the blinding factor directly from the passed - in rng .
fn blind<CS: CipherSuite, R: RngCore + CryptoRng>(
    rng: &mut R,
    password: &[u8],
) -> Result<
    voprf::NonVerifiableClientBlindResult<CS::OprfGroup, CS::Hash>,
    voprf::errors::InternalError,
> {
    #[cfg(not(test))]
    let result = voprf::NonVerifiableClient::blind(password.to_vec(), rng)?;
    #[cfg(test)]
    let result = {
        let mut blind_bytes = vec![0u8; <CS::OprfGroup as Group>::ScalarLen::USIZE];
        let blind = loop {
            rng.fill_bytes(&mut blind_bytes);
            let scalar = <CS::OprfGroup as Group>::from_scalar_slice_unchecked(
                &GenericArray::clone_from_slice(&blind_bytes),
            )?;
            match scalar
                .ct_eq(&<CS::OprfGroup as Group>::scalar_zero())
                .into()
            {
                false => break scalar,
                true => (),
            }
        };
        voprf::NonVerifiableClient::deterministic_blind_unchecked(password.to_vec(), blind)?
    };
    Ok(result)
}
fn blind < CS : CipherSuite , R : RngCore + CryptoRng > ( rng : & mut R , password : & [ u8 ] , ) -> Result < voprf :: NonVerifiableClientBlindResult < CS :: OprfGroup , CS :: Hash > , voprf :: errors :: InternalError , > { # [ cfg ( not ( test ) ) ] let result = voprf :: NonVerifiableClient :: blind ( password . to_vec ( ) , rng ) ? ; # [ cfg ( test ) ] let result = { let mut blind_bytes = vec ! [ 0u8 CS OprfGroup as Group ScalarLen USIZE ] ; let blind = loop { rng . fill_bytes ( & mut blind_bytes ) ; let scalar = < CS :: OprfGroup as Group > :: from_scalar_slice_unchecked ( & GenericArray :: clone_from_slice ( & blind_bytes ) , ) ? ; match scalar . ct_eq ( & < CS :: OprfGroup as Group > :: scalar_zero ( ) ) . into ( ) { false => break scalar , true => ( ) , } } ; voprf :: NonVerifiableClient :: deterministic_blind_unchecked ( password . to_vec ( ) , blind ) ? } ; Ok ( result ) }
Internal function for computing the blind result by calling the
voprf library.
Internal function for computing the blind result by calling the voprf library .
rng
&mut R
password
&[u8]
rng
&mut R
password
&[u8]