libusual  0.1
Data Structures | Functions
usual/crypto/keccak_prng.h File Reference

Implements PRNG mode for Keccak sponge function. More...

Data Structures

struct  KeccakPRNG
 State structure. More...

Functions

bool keccak_prng_init (struct KeccakPRNG *prng, int capacity)
 Setup Keccak with specified capacity.
void keccak_prng_add_data (struct KeccakPRNG *prng, const void *data, size_t len)
 Merge entropy data into state.
bool keccak_prng_extract (struct KeccakPRNG *prng, void *data, size_t len)
 Extract PRNG bytes from state.

Detailed Description

Implements PRNG mode for Keccak sponge function.


Function Documentation

bool keccak_prng_init ( struct KeccakPRNG prng,
int  capacity 
)

Setup Keccak with specified capacity.

Parameters:
prngState structure to be initialized.
capacityKeccak capacity in bits.
Returns:
False if invalid capacity, true otherwise.
void keccak_prng_add_data ( struct KeccakPRNG prng,
const void *  data,
size_t  len 
)

Merge entropy data into state.

bool keccak_prng_extract ( struct KeccakPRNG prng,
void *  data,
size_t  len 
)

Extract PRNG bytes from state.

Returns:
True, if extraction was successful. False if state has not been initialzed with keccak_prng_add_data().