wolfSSL Manual
wolfSSL Manual
Docs -> wolfSSL Manual
Chapter 18: wolfCrypt API Reference
18.26 MD5
The functions in this section expose MD5 functionality to calling applications.
wc_InitMd5
Synopsis:
#include <wolfssl/wolfcrypt/md5.h>
int wc_InitMd5(md5* md5);
Description:
This function initializes md5. This is automatically called by wc_Md5Hash.
Return Values:
0: Returned upon successfully initializing
Parameters:
md5 - pointer to the md5 structure to use for encryption
Example:
md5 md5[1];
if ((ret = wc_InitMd5(md5)) != 0) {
WOLFSSL_MSG("wc_Initmd5 failed");
}
else {
wc_Md5Update(md5, data, len);
wc_Md5Final(md5, hash);
}
See Also:
wc_Md5Hash
wc_Md5Update
wc_Md5Final
wc_Md5Update
Synopsis:
#include <wolfssl/wolfcrypt/md5.h>
int wc_Md5Update(md5* md5, const byte* data, word32 len)
Description:
Can be called to continually hash the provided byte array of length len.
Return Values:
0: Returned upon successfully adding the data to the digest.
Parameters:
md5 - pointer to the md5 structure to use for encryption
data - the data to be hashed
len - length of data to be hashed
Example:
md5 md5[1];
if ((ret = wc_InitMd5(md5)) != 0) {
WOLFSSL_MSG("wc_Initmd5 failed");
}
else {
wc_Md5Update(md5, data, len);
wc_Md5Final(md5, hash);
}
See Also:
wc_Md5Hash
wc_Md5Final
wc_InitMd5
wc_Md5Hash
Synopsis:
#include <wolfssl/wolfcrypt/md5.h>
int wc_Md5Hash(const byte* data, word32 len, byte* hash)
Description:
Convenience function, handles all the hashing and places the result into hash.
Return Values:
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.
Parameters:
data - the data to hash
len - the length of data
hash - Byte array to hold hash value.
See Also:
wc_Md5Hash
wc_Md5Final
wc_InitMd5
wc_Md5Final
Synopsis:
#include <wolfssl/wolfcrypt/md5.h>
int wc_Md5Final(md5* md5, byte* hash)
Description:
Finalizes hashing of data. Result is placed into hash.
Return Values:
0: Returned upon successfully finalizing.
Parameters:
md5 - pointer to the md5 structure to use for encryption
hash - Byte array to hold hash value.
Example:
md5 md5[1];
if ((ret = wc_InitMd5(md5)) != 0) {
WOLFSSL_MSG("wc_Initmd5 failed");
}
else {
wc_Md5Update(md5, data, len);
wc_Md5Final(md5, hash);
}
See Also:
wc_Md5Hash
wc_Md5Final
wc_InitMd5
Questions? +1 (425) 245-8247