#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | _RDD_HASH_CONTAINER |
Defines | |
#define | RDD_MAX_DIGEST_LENGTH SHA512_DIGEST_LENGTH |
Typedefs | |
typedef struct _RDD_HASH_CONTAINER | RDD_HASH_CONTAINER |
Functions | |
int | rdd_get_hash (RDD_HASH_CONTAINER *self, const char *hash_type, uint8_t *hash) |
Retrieves a specific hash from the hashcontainer. | |
int | rdd_hash_present (RDD_HASH_CONTAINER *self, const char *hash_type, int *present) |
Checks if a specific hash is present in the hashcontainer. | |
int | rdd_new_hashcontainer (RDD_HASH_CONTAINER **self) |
Creates an object for storing hashes. | |
int | rdd_set_hash (RDD_HASH_CONTAINER *self, const char *hash_type, const uint8_t *hash) |
Stores a specific hash in the hashcontainer. | |
Variables | |
static const char | RDD_MD5 [] = "MD5" |
static const char | RDD_SHA1 [] = "SHA1" |
static const char | RDD_SHA256 [] = "SHA256" |
static const char | RDD_SHA384 [] = "SHA384" |
static const char | RDD_SHA512 [] = "SHA512" |
#define RDD_MAX_DIGEST_LENGTH SHA512_DIGEST_LENGTH |
Definition at line 46 of file hashcontainer.h.
typedef struct _RDD_HASH_CONTAINER RDD_HASH_CONTAINER |
int rdd_get_hash | ( | RDD_HASH_CONTAINER * | self, | |
const char * | hash_type, | |||
uint8_t * | hash | |||
) |
Retrieves a specific hash from the hashcontainer.
self | a pointer to the hashcontainer. | |
hash_type | a null-terminated string containing the hash name (md5 or sha-1, 256, 384, or 512). | |
hash | output value: space for storing the hash. It is assumed that sufficient space is available in hash (..._DIGEST_LENGTH). |
RDD_OK
on success; returns RDD_NOTFOUND
if the hash has not been storedin the hashcontainer. rdd_get_hash()
retrieves a hash from the hashcontainer.
Definition at line 107 of file hashcontainer.c.
References RDD_BADARG, RDD_MD5, RDD_NOTFOUND, RDD_OK, RDD_SHA1, RDD_SHA256, RDD_SHA384, and RDD_SHA512.
int rdd_hash_present | ( | RDD_HASH_CONTAINER * | self, | |
const char * | hash_type, | |||
int * | present | |||
) |
Checks if a specific hash is present in the hashcontainer.
self | a pointer to the hashcontainer. | |
hash_type | a null-terminated string containing the hash name (md5 or sha-1, 256, 384, or 512). | |
hash | output value: will be 1 if the hash is present, 0 if it's not. |
RDD_OK
on success. rdd_hash_present()
checks if a specific hash is present in the hash container.
Definition at line 152 of file hashcontainer.c.
References RDD_BADARG, RDD_MD5, RDD_OK, RDD_SHA1, RDD_SHA256, RDD_SHA384, and RDD_SHA512.
int rdd_new_hashcontainer | ( | RDD_HASH_CONTAINER ** | self | ) |
Creates an object for storing hashes.
self | output value: the new hashcontainer. |
RDD_OK
on success.rdd_new_hashes()
creates a new hashcontainer object.
Definition at line 49 of file hashcontainer.c.
References error(), RDD_BADARG, RDD_NOMEM, and RDD_OK.
int rdd_set_hash | ( | RDD_HASH_CONTAINER * | self, | |
const char * | hash_type, | |||
const uint8_t * | hash | |||
) |
Stores a specific hash in the hashcontainer.
self | a pointer to the hashcontainer. | |
hash_type | a null-terminated string containing the hash name (md5 or sha-1, 256, 384, or 512). | |
hash | the hash itself. It is assumed that sufficient space is available in hash (..._DIGEST_LENGTH). |
RDD_OK
on success.rdd_set_hash()
stores a hash in the hashcontainer.
Definition at line 73 of file hashcontainer.c.
References RDD_BADARG, RDD_MD5, RDD_OK, RDD_SHA1, RDD_SHA256, RDD_SHA384, and RDD_SHA512.
const char RDD_MD5[] = "MD5" [static] |
Definition at line 48 of file hashcontainer.h.
const char RDD_SHA1[] = "SHA1" [static] |
Definition at line 49 of file hashcontainer.h.
const char RDD_SHA256[] = "SHA256" [static] |
Definition at line 50 of file hashcontainer.h.
const char RDD_SHA384[] = "SHA384" [static] |
Definition at line 51 of file hashcontainer.h.
const char RDD_SHA512[] = "SHA512" [static] |
Definition at line 52 of file hashcontainer.h.