Leancrypto 1.6.0
Post-Quantum Cryptographic Library
Loading...
Searching...
No Matches
lc_hash.h File Reference
#include "ext_headers.h"
#include "lc_memset_secure.h"
#include "lc_memory_support.h"
Include dependency graph for lc_hash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LC_HASH_CTX_ON_STACK(name, hashname)
 Allocate stack memory for the hash context.

Functions

int lc_hash_init (struct lc_hash_ctx *hash_ctx)
 Initialize hash context.
void lc_hash_update (struct lc_hash_ctx *hash_ctx, const uint8_t *in, size_t inlen)
 Update hash.
void lc_hash_final (struct lc_hash_ctx *hash_ctx, uint8_t *digest)
 Calculate message digest.
void lc_hash_set_digestsize (struct lc_hash_ctx *hash_ctx, size_t digestsize)
 Set the size of the message digest - this call is intended for SHAKE.
size_t lc_hash_digestsize (struct lc_hash_ctx *hash_ctx)
 Get the size of the message digest.
unsigned int lc_hash_blocksize (struct lc_hash_ctx *hash_ctx)
 Get the block size of the message digest (or the "rate" in terms of Sponge-based algorithms).
unsigned int lc_hash_ctxsize (struct lc_hash_ctx *hash_ctx)
 Get the context size of the message digest implementation.
void lc_hash_zero (struct lc_hash_ctx *hash_ctx)
 Zeroize Hash context allocated with either LC_HASH_CTX_ON_STACK or lc_hmac_alloc.
int lc_hash_alloc (const struct lc_hash *hash, struct lc_hash_ctx **hash_ctx)
 Allocate Hash context on heap.
void lc_hash_zero_free (struct lc_hash_ctx *hash_ctx)
 Zeroize and free hash context.
int lc_hash (const struct lc_hash *hash, const uint8_t *in, size_t inlen, uint8_t *digest)
 Calculate message digest - one-shot.
int lc_xof (const struct lc_hash *xof, const uint8_t *in, size_t inlen, uint8_t *digest, size_t digestlen)
 Calculate message digest for an XOF - one-shot.
int lc_sponge (const struct lc_hash *hash, void *state, unsigned int rounds)
 Perform Sponge permutation on buffer.
int lc_sponge_add_bytes (const struct lc_hash *hash, void *state, const uint8_t *data, size_t offset, size_t length)
 Function to add (in GF(2), using bitwise exclusive-or) data given as bytes into the sponge state.
int lc_sponge_extract_bytes (const struct lc_hash *hash, const void *state, uint8_t *data, size_t offset, size_t length)
 Function to retrieve data from the state. The bit positions that are retrieved by this function are from offset*8 to offset*8 + length*8.
int lc_sponge_newstate (const struct lc_hash *hash, void *state, const uint8_t *data, size_t offset, size_t length)
 Function to insert a complete new sponge state.
uint64_t lc_hash_algorithm_type (const struct lc_hash *hash)
 Obtain algorithm type usable with lc_alg_status.
uint64_t lc_hash_ctx_algorithm_type (const struct lc_hash_ctx *ctx)
 Obtain algorithm type usable with lc_alg_status.