KallistiOS
##version##
|
Message Digest 5 (MD5) hashing support. More...
Go to the source code of this file.
Data Structures | |
struct | kos_md5_cxt |
MD5 context. More... | |
Typedefs | |
typedef struct kos_md5_cxt | kos_md5_cxt_t |
MD5 context. More... | |
Functions | |
void | kos_md5_start (kos_md5_cxt_t *cxt) |
Initialize a MD5 context. More... | |
void | kos_md5_hash_block (kos_md5_cxt_t *cxt, const uint8 *input, uint32 size) |
Hash a block of data with MD5. More... | |
void | kos_md5_finish (kos_md5_cxt_t *cxt, uint8 output[16]) |
Complete a MD5 hash. More... | |
void | kos_md5 (const uint8 *input, uint32 size, uint8 output[16]) |
Compute the hash of a block of data with MD5. More... | |
Message Digest 5 (MD5) hashing support.
This file provides the functionality to compute MD5 hashes over any data buffer. While MD5 isn't considered a safe cryptographic hash any more, it still has its uses.
typedef struct kos_md5_cxt kos_md5_cxt_t |
MD5 context.
This structure contains the variables needed to maintain the internal state of the MD5 code. You should not manipulate these variables manually, but rather use the kos_md5_* functions to do everything you need.
Compute the hash of a block of data with MD5.
This function is used to hash a full block of data without messing around with any contexts or anything else of the sort. This is appropriate if you have all the data you want to hash readily available. It takes care of all of the context setup and teardown for you.
input | The data to hash. |
size | The number of bytes of input data passed in. |
output | Where to store the final message digest. |
void kos_md5_finish | ( | kos_md5_cxt_t * | cxt, |
uint8 | output[16] | ||
) |
Complete a MD5 hash.
This function computes the final MD5 hash of the context passed in, returning the completed digest in the output parameter.
cxt | The MD5 context to finalize. |
output | Where to store the final digest. |
void kos_md5_hash_block | ( | kos_md5_cxt_t * | cxt, |
const uint8 * | input, | ||
uint32 | size | ||
) |
Hash a block of data with MD5.
This function is used to hash the block of data input into the function with MD5, updating the state context as appropriate. If the data does not fill an entire block of 64-bytes (or there is left-over data), it will be stored in the context for hashing with a future block. Thus, do not attempt to read the intermediate hash value, as it will not be complete.
cxt | The MD5 context to use. |
input | The block of data to hash. |
size | The number of bytes of input data passed in. |
void kos_md5_start | ( | kos_md5_cxt_t * | cxt | ) |
Initialize a MD5 context.
This function initializes the context passed in to the initial state needed for computing a MD5 hash. You must call this function to initialize the state variables before attempting to hash any blocks of data.
cxt | The MD5 context to initialize. |