Skip to content

Algorithms - MD2

Functions

Name
void wc_InitMd2(Md2 * )
This function initializes md2. This is automatically called by wc_Md2Hash.
void wc_Md2Update(Md2 * md2, const byte * data, word32 len)
Can be called to continually hash the provided byte array of length len.
void wc_Md2Final(Md2 * md2, byte * hash)
Finalizes hashing of data. Result is placed into hash.
int wc_Md2Hash(const byte * data, word32 len, byte * hash)
Convenience function, handles all the hashing and places the result into hash.

Functions Documentation

function wc_InitMd2

void wc_InitMd2(
    Md2 * 
)

This function initializes md2. This is automatically called by wc_Md2Hash.

Parameters:

  • md2 pointer to the md2 structure to use for encryption

See:

Return: 0 Returned upon successfully initializing

Example

md2 md2[1];
if ((ret = wc_InitMd2(md2)) != 0) {
   WOLFSSL_MSG("wc_Initmd2 failed");
}
else {
   wc_Md2Update(md2, data, len);
   wc_Md2Final(md2, hash);
}

function wc_Md2Update

void wc_Md2Update(
    Md2 * md2,
    const byte * data,
    word32 len
)

Can be called to continually hash the provided byte array of length len.

Parameters:

  • md2 pointer to the md2 structure to use for encryption
  • data the data to be hashed
  • len length of data to be hashed

See:

Return: 0 Returned upon successfully adding the data to the digest.

Example

md2 md2[1];
byte data[] = { }; // Data to be hashed
word32 len = sizeof(data);

if ((ret = wc_InitMd2(md2)) != 0) {
   WOLFSSL_MSG("wc_Initmd2 failed");
}
else {
   wc_Md2Update(md2, data, len);
   wc_Md2Final(md2, hash);
}

function wc_Md2Final

void wc_Md2Final(
    Md2 * md2,
    byte * hash
)

Finalizes hashing of data. Result is placed into hash.

Parameters:

  • md2 pointer to the md2 structure to use for encryption
  • hash Byte array to hold hash value.

See:

Return: 0 Returned upon successfully finalizing.

Example

md2 md2[1];
byte data[] = { }; // Data to be hashed
word32 len = sizeof(data);

if ((ret = wc_InitMd2(md2)) != 0) {
   WOLFSSL_MSG("wc_Initmd2 failed");
}
else {
   wc_Md2Update(md2, data, len);
   wc_Md2Final(md2, hash);
}

function wc_Md2Hash

int wc_Md2Hash(
    const byte * data,
    word32 len,
    byte * hash
)

Convenience function, handles all the hashing and places the result into hash.

Parameters:

  • data the data to hash
  • len the length of data
  • hash Byte array to hold hash value.

See:

Return:

  • 0 Returned upon successfully hashing the data.
  • Memory_E memory error, unable to allocate memory. This is only possible with the small stack option enabled.

Example

none

Updated on 2022-06-25 at 08:30:56 +0000