src/hashcontainer.h File Reference

#include <stdint.h>

Include dependency graph for hashcontainer.h:

This graph shows which files directly or indirectly include this file:

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 Documentation

#define RDD_MAX_DIGEST_LENGTH   SHA512_DIGEST_LENGTH

Definition at line 46 of file hashcontainer.h.


Typedef Documentation


Function Documentation

int rdd_get_hash ( RDD_HASH_CONTAINER self,
const char *  hash_type,
uint8_t *  hash 
)

Retrieves a specific hash from the hashcontainer.

Parameters:
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).
Returns:
Returns RDD_OK on success; returns RDD_NOTFOUND if the hash has not been storedin the hashcontainer.
Note:
.
Routine 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.

Parameters:
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.
Returns:
Returns RDD_OK on success.
Note:
.
Routine 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.

Parameters:
self output value: the new hashcontainer.
Returns:
Returns RDD_OK on success.
Routine 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.

Here is the call graph for this function:

int rdd_set_hash ( RDD_HASH_CONTAINER self,
const char *  hash_type,
const uint8_t *  hash 
)

Stores a specific hash in the hashcontainer.

Parameters:
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).
Returns:
Returns RDD_OK on success.
Routine 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.


Variable Documentation

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.


Generated on Sun Feb 6 12:36:13 2011 for rdd by  doxygen 1.5.6