Functions
Algorithms - RIPEMD

Functions

WOLFSSL_API int wc_InitRipeMd (RipeMd *)
 This function initializes a ripemd structure by initializing ripemd’s digest, buffer, loLen and hiLen. More...
 
WOLFSSL_API int wc_RipeMdUpdate (RipeMd *, const byte *, word32)
 This function generates the RipeMd digest of the data input and stores the result in the ripemd->digest buffer. After running wc_RipeMdUpdate, one should compare the generated ripemd->digest to a known authentication tag to verify the authenticity of a message. More...
 
WOLFSSL_API int wc_RipeMdFinal (RipeMd *, byte *)
 This function copies the computed digest into hash. If there is a partial unhashed block, this method will pad the block with 0s, and include that block’s round in the digest before copying to hash. State of ripemd is reset. More...
 

Detailed Description

Function Documentation

◆ wc_InitRipeMd()

WOLFSSL_API int wc_InitRipeMd ( RipeMd )

This function initializes a ripemd structure by initializing ripemd’s digest, buffer, loLen and hiLen.

Returns
0 returned on successful execution of the function. The RipeMd structure is initialized.
BAD_FUNC_ARG returned if the RipeMd structure is NULL.
Parameters
ripemdpointer to the ripemd structure to initialize

Example

RipeMd md;
int ret;
ret = wc_InitRipeMd(&md);
if (ret != 0) {
// Failure case.
}
See also
wc_RipeMdUpdate
wc_RipeMdFinal

◆ wc_RipeMdFinal()

WOLFSSL_API int wc_RipeMdFinal ( RipeMd ,
byte *   
)

This function copies the computed digest into hash. If there is a partial unhashed block, this method will pad the block with 0s, and include that block’s round in the digest before copying to hash. State of ripemd is reset.

Returns
0 Returned on successful execution of the function. The state of the RipeMd structure has been reset.
BAD_FUNC_ARG Returned if the RipeMd structure or hash parameters are NULL.
Parameters
ripemdpointer to the ripemd structure to be initialized with wc_InitRipeMd, and containing hashes from wc_RipeMdUpdate. State will be reset
hashbuffer to copy digest to. Should be RIPEMD_DIGEST_SIZE bytes

Example

RipeMd md;
int ret;
byte digest[RIPEMD_DIGEST_SIZE];
const byte* data; // The data to be hashed
...
ret = wc_InitRipeMd(&md);
if (ret == 0) {
ret = wc_RipeMdUpdate(&md, plain, sizeof(plain));
if (ret != 0) {
// RipeMd Update Failure Case.
}
ret = wc_RipeMdFinal(&md, digest);
if (ret != 0) {
// RipeMd Final Failure Case.
}...
See also
none

◆ wc_RipeMdUpdate()

WOLFSSL_API int wc_RipeMdUpdate ( RipeMd ,
const byte *  ,
word32   
)

This function generates the RipeMd digest of the data input and stores the result in the ripemd->digest buffer. After running wc_RipeMdUpdate, one should compare the generated ripemd->digest to a known authentication tag to verify the authenticity of a message.

Returns
0 Returned on successful execution of the function.
BAD_FUNC_ARG Returned if the RipeMd structure is NULL or if data is NULL and len is not zero. This function should execute if data is NULL and len is 0.
Parameters
ripemdpointer to the ripemd structure to be initialized with wc_InitRipeMd
datadata to be hashed
lensizeof data in bytes

Example

const byte* data; // The data to be hashed
....
RipeMd md;
int ret;
ret = wc_InitRipeMd(&md);
if (ret == 0) {
ret = wc_RipeMdUpdate(&md, plain, sizeof(plain));
if (ret != 0) {
// Failure case …
See also
wc_InitRipeMd
wc_RipeMdFinal