|
MD5 and HMAC-MD5 class
Spaniakos - MD5 and HMAC-MD5 class for arduino and Raspberry Pi
|
#include <MD5.h>
Public Member Functions | |
| MD5 () | |
| unsigned char * | make_hash (const void *arg) |
| char * | make_digest (const unsigned char *digest, int len) |
| char * | md5 (const void *arg) |
| void | hmac_md5 (const void *text, int text_len, void *key, int key_len, unsigned char *digest) |
| char * | hmac_md5 (const void *text, int text_len, void *key, int key_len) |
| double | millis () |
Static Public Member Functions | |
| static const void * | body (void *ctxBuf, const void *data, size_t size) |
| static void | MD5Init (void *ctxBuf) |
| static void | MD5Final (unsigned char *result, void *ctxBuf) |
| static void | MD5Update (void *ctxBuf, const void *data, size_t size) |
Private Attributes | |
| timeval | tv |
| MD5::MD5 | ( | ) |
class constructor. Does nothing.
| unsigned char * MD5::make_hash | ( | const void * | arg | ) |
| char * MD5::make_digest | ( | const unsigned char * | digest, |
| int | len | ||
| ) |
Converts a digest to a string.
In order for tedigest to be readable and printed easyly, we need to conver it.
| *digest | pointer to the array that holds the digest |
| len | integer defining the lengs of the output, usually 16 for MD5 |
| char * MD5::md5 | ( | const void * | arg | ) |
Automation function. Gets a pointer to sequence of chars, Then Hashes it, and converts it to a readable form,
| *arg | pointer to the string that will be hashed. |
| void MD5::hmac_md5 | ( | const void * | text, |
| int | text_len, | ||
| void * | key, | ||
| int | key_len, | ||
| unsigned char * | digest | ||
| ) |
Main function of the HMAC-MD5. gets the key and the text, and creates the HMAC-MD5 digest function. in order to be pronted, it is required for the make_digest function to be called.
| *text | pointer to the text that will be hashed. |
| text_len | integet value of the length of the text. |
| *key | pointer to the key that will be used in the HMAC process. |
| key_len | integer value of the key length. |
| *digest | pointer to the array that will hold the digest of this process |
| char * MD5::hmac_md5 | ( | const void * | text, |
| int | text_len, | ||
| void * | key, | ||
| int | key_len | ||
| ) |
Main function of the HMAC-MD5. gets the key and the text, and creates the HMAC-MD5 digest function in a readable format.
| *text | pointer to the text that will be hashed. |
| text_len | integet value of the length of the text. |
| *key | pointer to the key that will be used in the HMAC process. |
| key_len | integer value of the key length. |
|
static |
This processes one or more 64-byte data blocks, but does NOT update the bit counters. There are no alignment requirements.
| *ctxBuf | the ctx buffer that will be used |
| *data | pointer to the data that will be processed |
| size | size_t type, that hold the size |
|
static |
Initialized the MD5 hashing process. this function must be called before MD5Update or MD5Final
| *ctxBuf | the ctx buffer that will be used |
|
static |
MD5Final finilized the Hashing process and creates the diggest. This function must be called after MD5Init and MD5Update
| *result | pointer that will hold the digest. |
| *ctxBuf | the ctx buffer that will be used |
|
static |
MD5Update adds data in the buffers. This function can be used as many times as we want in the hashing process. Examples on hmac_md5 functions.
| *ctxBuf | the ctx buffer that will be used |
| *data | the actual data that will be used in the hashing process. |
| size | size_t type, indicated the side of the data pointer. |
| double MD5::millis | ( | ) |
used in linux in order to retrieve the time in milliseconds.
|
private |
holds the time value on linux
1.8.9.1