lcx_blake2.h | Developers

lcx_blake2.h

Back to the files list

BLAKE2 crypographic hash function. More...

Data Structures

struct  blake2b_state__
 BLAKE2b state members. More...
struct  cx_blake2b_s
 BLAKE2b context. More...

Typedefs

typedef struct blake2b_state__ blake2b_state
 BLAKE2b state. More...
typedef struct cx_blake2b_s cx_blake2b_t
 Convenience type. More...

Enumerations

enum  blake2b_constant {
  BLAKE2B_BLOCKBYTES = 128, BLAKE2B_OUTBYTES = 64, BLAKE2B_KEYBYTES = 64, BLAKE2B_SALTBYTES = 16,
  BLAKE2B_PERSONALBYTES = 16
}
 BLAKE2b constants. More...

Functions

cx_err_t cx_blake2b_init_no_throw (cx_blake2b_t *hash, size_t out_len)
 Initializes BLAKE2b message digest context. More...
static int cx_blake2b_init (cx_blake2b_t *hash, unsigned int out_len)
 Initializes BLAKE2b message digest context. More...
cx_err_t cx_blake2b_init2_no_throw (cx_blake2b_t *hash, size_t out_len, uint8_t *salt, size_t salt_len, uint8_t *perso, size_t perso_len)
 Initializes BLAKE2b message digest context with salt and personnalization string. More...
static int cx_blake2b_init2 (cx_blake2b_t *hash, unsigned int out_len, unsigned char *salt, unsigned int salt_len, unsigned char *perso, unsigned int perso_len)
 Initializes BLAKE2b message digest context with salt and personnalization string. More...

Detailed Description

BLAKE2 crypographic hash function.

BLAKE2b is a cryptographic hash function optimized for 64-bit platforms that produces digests of any size between 1 and 64 bytes. It is specified at https://blake2.net.

Typedef Documentation

blake2b_state

BLAKE2b state.

cx_blake2b_t

typedef struct cx_blake2b_s cx_blake2b_t

Convenience type.

See cx_blake2b_s.

Enumeration Type Documentation

blake2b_constant

BLAKE2b constants.

Enumerator
BLAKE2B_BLOCKBYTES 

Size of a block.

BLAKE2B_OUTBYTES 

Size of the output.

BLAKE2B_KEYBYTES 

Size of the key.

BLAKE2B_SALTBYTES 

Size of the salt.

BLAKE2B_PERSONALBYTES 

Size of the personalization string.

Function Documentation

cx_blake2b_init()

static int cx_blake2b_init ( cx_blake2b_t hash,
unsigned int  out_len 
)

Initializes BLAKE2b message digest context.

This function throws an exception if the initialization fails.

Warning
It is recommended to use cx_blake2b_init_no_throw rather than this function.
Parameters
[out]hashPointer to the BLAKE2b context to initialize. The context shall be in RAM.
[in]out_lenDigest size in bits.
Returns
BLAKE2b identifier.
Exceptions
CX_INVALID_PARAMETER

cx_blake2b_init2()

static int cx_blake2b_init2 ( cx_blake2b_t hash,
unsigned int  out_len,
unsigned char *  salt,
unsigned int  salt_len,
unsigned char *  perso,
unsigned int  perso_len 
)

Initializes BLAKE2b message digest context with salt and personnalization string.

This function throws an exception if the initialization fails.

Warning
It is recommended to use cx_blake2b_init2_no_throw rather than this function.
Parameters
[out]hashPointer to the BLAKE2b context to initialize. The context shall be in RAM.
[in]out_lenDigest size in bits.
[in]saltPointer to a salt (optional).
[in]salt_lenLength of the salt.
[in]persoPointer to a personalization string (optional).
[in]perso_lenLength of the personalization string.
Returns
BLAKE2b identifier.
Exceptions
CX_INVALID_PARAMETER

cx_blake2b_init2_no_throw()

cx_err_t cx_blake2b_init2_no_throw ( cx_blake2b_t hash,
size_t  out_len,
uint8_t *  salt,
size_t  salt_len,
uint8_t *  perso,
size_t  perso_len 
)

Initializes BLAKE2b message digest context with salt and personnalization string.

Parameters
[out]hashPointer to the BLAKE2b context to initialize. The context shall be in RAM.
[in]out_lenDigest size in bits.
[in]saltPointer to a salt (optional).
[in]salt_lenLength of the salt.
[in]persoPointer to a personalization string (optional).
[in]perso_lenLength of the personalization string.
Returns
Error code:
  • CX_OK on success
  • CX_INVALID_PARAMETER

cx_blake2b_init_no_throw()

cx_err_t cx_blake2b_init_no_throw ( cx_blake2b_t hash,
size_t  out_len 
)

Initializes BLAKE2b message digest context.

Parameters
[out]hashPointer to the BLAKE2b context to initialize. The context shall be in RAM.
[in]out_lenDigest size in bits.
Returns
Error code:
  • CX_OK
  • CX_INVALID_PARAMETER

Back to the files list


Did you find this page helpful?


How would you improve this page for developers?



Getting Started
Theme Features
Customization

Nano Apps