Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
Data Structures | Macros | Functions
photon-beetle-hash.h File Reference

PHOTON-Beetle hash algorithm. More...

#include <stddef.h>

Go to the source code of this file.

Data Structures

union  photon_beetle_hash_state_t
 State information for the PHOTON-Beetle-HASH incremental mode. More...
 

Macros

#define PHOTON_BEETLE_HASH_SIZE   32
 Size of the hash output for PHOTON-Beetle-HASH.
 

Functions

int photon_beetle_hash (unsigned char *out, const unsigned char *in, size_t inlen)
 Hashes a block of input data with PHOTON-Beetle-HASH to generate a hash value. More...
 
void photon_beetle_hash_init (photon_beetle_hash_state_t *state)
 Initializes the state for a Photon-Beetle-HASH hashing operation. More...
 
void photon_beetle_hash_update (photon_beetle_hash_state_t *state, const unsigned char *in, size_t inlen)
 Updates a Photon-Beetle-HASH state with more input data. More...
 
void photon_beetle_hash_finalize (photon_beetle_hash_state_t *state, unsigned char *out)
 Returns the final hash value from a Photon-Beetle-HASH hashing operation. More...
 

Detailed Description

PHOTON-Beetle hash algorithm.

PHOTON-Beetle-Hash has a 256-bit hash output. The initial data is handled as a 16 byte block, and then the remaining bytes are processed in 4 byte blocks.

References: https://www.isical.ac.in/~lightweight/beetle/

Function Documentation

int photon_beetle_hash ( unsigned char *  out,
const unsigned char *  in,
size_t  inlen 
)

Hashes a block of input data with PHOTON-Beetle-HASH to generate a hash value.

Parameters
outBuffer to receive the hash output which must be at least PHOTON_BEETLE_HASH_SIZE bytes in length.
inPoints to the input data to be hashed.
inlenLength of the input data in bytes.
Returns
Returns zero on success or -1 if there was an error in the parameters.
See Also
photon_beetle_hash_init()
void photon_beetle_hash_finalize ( photon_beetle_hash_state_t state,
unsigned char *  out 
)

Returns the final hash value from a Photon-Beetle-HASH hashing operation.

Parameters
stateHash state to be finalized.
outBuffer to receive the hash output which must be at least PHOTON_BEETLE_HASH_SIZE bytes in length.
See Also
photon_beetle_hash_init(), photon_beetle_hash_update()
void photon_beetle_hash_init ( photon_beetle_hash_state_t state)

Initializes the state for a Photon-Beetle-HASH hashing operation.

Parameters
stateHash state to be initialized.
See Also
photon_beetle_hash_update(), photon_beetle_hash_finalize(), photon_beetle_hash()
void photon_beetle_hash_update ( photon_beetle_hash_state_t state,
const unsigned char *  in,
size_t  inlen 
)

Updates a Photon-Beetle-HASH state with more input data.

Parameters
stateHash state to be updated.
inPoints to the input data to be incorporated into the state.
inlenLength of the input data to be incorporated into the state.
See Also
photon_beetle_hash_init(), photon_beetle_hash_finalize()