My Project
Functions
Algorithms - BLAKE2

Functions

int wc_InitBlake2b (Blake2b *b2b, word32 digestSz)
 This function initializes a Blake2b structure for use with the Blake2 hash function. More...
 
int wc_Blake2bUpdate (Blake2b *b2b, const byte *data, word32 sz)
 This function updates the Blake2b hash with the given input data. This function should be called after wc_InitBlake2b, and repeated until one is ready for the final hash: wc_Blake2bFinal. More...
 
int wc_Blake2bFinal (Blake2b *b2b, byte *final, word32 requestSz)
 This function computes the Blake2b hash of the previously supplied input data. The output hash will be of length requestSz, or, if requestSz==0, the digestSz of the b2b structure. This function should be called after wc_InitBlake2b and wc_Blake2bUpdate has been processed for each piece of input data desired. More...
 

Detailed Description

Function Documentation

◆ wc_Blake2bFinal()

int wc_Blake2bFinal ( Blake2b *  b2b,
byte *  final,
word32  requestSz 
)

This function computes the Blake2b hash of the previously supplied input data. The output hash will be of length requestSz, or, if requestSz==0, the digestSz of the b2b structure. This function should be called after wc_InitBlake2b and wc_Blake2bUpdate has been processed for each piece of input data desired.

Returns
0 Returned upon successfully computing the Blake2b hash
-1 Returned if there is a failure while parsing the Blake2b hash
Parameters
b2bpointer to the Blake2b structure to update
finalpointer to a buffer in which to store the blake2b hash. Should be of length requestSz
requestSzlength of the digest to compute. When this is zero, b2b->digestSz will be used instead

Example

int ret;
Blake2b b2b;
byte hash[64];
// initialize Blake2b structure with 64 byte digest
wc_InitBlake2b(&b2b, 64);
... // call wc_Blake2bUpdate to add data to hash
ret = wc_Blake2bFinal(&b2b, hash, 64);
if( ret != 0) {
// error generating blake2b hash
}
int wc_Blake2bFinal(Blake2b *b2b, byte *final, word32 requestSz)
This function computes the Blake2b hash of the previously supplied input data. The output hash will b...
int wc_InitBlake2b(Blake2b *b2b, word32 digestSz)
This function initializes a Blake2b structure for use with the Blake2 hash function.
See also
wc_InitBlake2b
wc_Blake2bUpdate

◆ wc_Blake2bUpdate()

int wc_Blake2bUpdate ( Blake2b *  b2b,
const byte *  data,
word32  sz 
)

This function updates the Blake2b hash with the given input data. This function should be called after wc_InitBlake2b, and repeated until one is ready for the final hash: wc_Blake2bFinal.

Returns
0 Returned upon successfully update the Blake2b structure with the given data
-1 Returned if there is a failure while compressing the input data
Parameters
b2bpointer to the Blake2b structure to update
datapointer to a buffer containing the data to append
szlength of the input data to append

Example

int ret;
Blake2b b2b;
// initialize Blake2b structure with 64 byte digest
wc_InitBlake2b(&b2b, 64);
byte plain[] = { // initialize input };
ret = wc_Blake2bUpdate(&b2b, plain, sizeof(plain));
if( ret != 0) {
// error updating blake2b
}
int wc_Blake2bUpdate(Blake2b *b2b, const byte *data, word32 sz)
This function updates the Blake2b hash with the given input data. This function should be called afte...
See also
wc_InitBlake2b
wc_Blake2bFinal

◆ wc_InitBlake2b()

int wc_InitBlake2b ( Blake2b *  b2b,
word32  digestSz 
)

This function initializes a Blake2b structure for use with the Blake2 hash function.

Returns
0 Returned upon successfully initializing the Blake2b structure and setting the digest size.
Parameters
b2bpointer to the Blake2b structure to initialize
digestSzlength of the blake 2 digest to implement

Example

Blake2b b2b;
// initialize Blake2b structure with 64 byte digest
wc_InitBlake2b(&b2b, 64);
See also
wc_Blake2bUpdate