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

Simple API to Keccak1600 permutation + sponge. More...

Data Structures

struct  KeccakContext
 Keccak state structure for all modes. More...

Functions

int keccak_init (struct KeccakContext *ctx, unsigned int capacity)
 Set up state with specified capacity.
void keccak_absorb (struct KeccakContext *ctx, const void *data, size_t len)
 Hash additional data.
void keccak_squeeze (struct KeccakContext *ctx, uint8_t *dst, size_t len)
 Extract bytes from state.
void keccak_squeeze_xor (struct KeccakContext *ctx, uint8_t *dst, const void *src, size_t len)
 Extract bytes from state, XOR into data.
void keccak_encrypt (struct KeccakContext *ctx, uint8_t *dst, const void *src, size_t len)
 XOR data into state and return it.
void keccak_decrypt (struct KeccakContext *ctx, uint8_t *dst, const void *src, size_t len)
 XOR state with data and return it.
void keccak_pad (struct KeccakContext *ctx, const void *data, size_t len)
 Hash pad suffix.
void keccak_rewind (struct KeccakContext *ctx)
 Move internal position to start of buffer.
void keccak_forget (struct KeccakContext *ctx)
 Clear rate bits.

Detailed Description

Simple API to Keccak1600 permutation + sponge.


Function Documentation

int keccak_init ( struct KeccakContext ctx,
unsigned int  capacity 
)

Set up state with specified capacity.

Returns 1 if successful, 0 if invalid capacity.

void keccak_absorb ( struct KeccakContext ctx,
const void *  data,
size_t  len 
)

Hash additional data.

void keccak_squeeze ( struct KeccakContext ctx,
uint8_t *  dst,
size_t  len 
)

Extract bytes from state.

void keccak_squeeze_xor ( struct KeccakContext ctx,
uint8_t *  dst,
const void *  src,
size_t  len 
)

Extract bytes from state, XOR into data.

void keccak_encrypt ( struct KeccakContext ctx,
uint8_t *  dst,
const void *  src,
size_t  len 
)

XOR data into state and return it.

void keccak_decrypt ( struct KeccakContext ctx,
uint8_t *  dst,
const void *  src,
size_t  len 
)

XOR state with data and return it.

void keccak_pad ( struct KeccakContext ctx,
const void *  data,
size_t  len 
)

Hash pad suffix.

void keccak_rewind ( struct KeccakContext ctx)

Move internal position to start of buffer.

Useful for PRNG/duplex modes.

void keccak_forget ( struct KeccakContext ctx)

Clear rate bits.