Main Page   Compound List   File List   Compound Members   File Members  

hasher.c File Reference

#include "hasher.h"

Include dependency graph for hasher.c:

Include dependency graph

Defines

#define COMMENT

Functions

hasher_retcode hasher_setup (hasher_t *H, const char *algostr)
void hasher_init (hasher_t *H)
void hasher_update (hasher_t *H, const uns8 *data, uns32 len)
void hasher_final (hasher_t *H, uns8 *d)
hasher_retcode hasher_teardown (hasher_t *H)
const char* hasher_ret_msg (hasher_retcode c)

Variables

const int hasher_lengths [CRYPTO_HASH_COUNT][2]

Define Documentation

#define COMMENT
 

Value:

A contribution to the open-source movement. Jean-Luc Cooke <jlcooke@certainkey.com> CertainKey Inc. Ottawa Ontario Canada

Created: July 20th, 2001

The following program code is released under the GPL license http://www.gnu.org/copyleft/gpl.html


Function Documentation

void hasher_final ( hasher_t * H,
uns8 * result )
 

Finalize the structure and produce a digest

Parameters:
H   the hasher pseudo-object requiring the H->final(H,result)
result   byte array of AT LEAST H->len bytes in size

void hasher_init ( hasher_t * H )
 

Initalize the hasher pseudo-object Resets the digest internal state to unity

const char * hasher_ret_msg ( hasher_retcode c )
 

Provide a human readable representation of an hasher_retcode error code

Parameters:
c   the hasher_ret_msg returned by a hasher static or pseudo-object member function

hasher_retcode hasher_setup ( hasher_t * H,
const char * algo )
 

Setup the hasher object for use

Parameters:
H   the hasher pseudo-object to be setup
algo   string representation of the algorithm to be used for the lifetime of this structure (eg. "md5", "sha-1", "sha-2", "ripemd-160")
See also:
hasher_ret_msg

hasher_retcode hasher_teardown ( hasher_t * H )
 

De-allocate and erase the components of the hasher

Parameters:
H   the hasher pseudo-object to be releasd
See also:
hasher_ret_msg

void hasher_update ( hasher_t * H,
const uns8 * data,
uns32 len )
 

Update the current state of hasher Operations are buffered, thus alignment issues are abstracted from lucky programm who uses this!

Parameters:
H   the hasher pseudo-object requiring the H->update(H,data,len)
data   pointer to array of bytes to process
len   length in bytes of the input


Variable Documentation

const int hasher_lengths
 

Initial value:

 {
  {CRYPTO_HASH_MD5, MD5_DIGEST_SIZE},
  {CRYPTO_HASH_SHA1, SHA1_DIGEST_SIZE},
  {CRYPTO_HASH_RIPEMD160, RIPEMD160_DIGEST_SIZE},
  {CRYPTO_HASH_SHA2, SHA2_DIGEST_SIZE},
}
Array of digest lengths
See also:
hash_t


Confidential