Main Page   Data Structures   File List   Data Fields   Globals  

hash.h File Reference

Hash (message digest) algorithm support. More...

#include <cyfer/cyfer.h>

Go to the source code of this file.

Data Structures

struct  CYFER_Hash_t
 A structure describing supported hash algorithms. More...


Defines

#define CYFER_HASH_NONE   0
#define CYFER_HASH_MD4   1
#define CYFER_HASH_MD5   2
#define CYFER_HASH_SHA1   3
#define CYFER_HASH_RMD160   4
#define CYFER_HASH_ADLER32   5
#define CYFER_HASH_SNEFRU   6
#define CYFER_HASH_CRC32   7
#define CYFER_HASH_MD2   8
#define CYFER_HASH_SHA256   9

Typedefs

typedef void CYFER_HASH_CTX
 Hash algorithm context.


Functions

CYFER_Hash_tCYFER_Hash_Get_Supported (void)
 Returns a list of supported hash algorithms.

int CYFER_Hash_Select (const char *name, size_t *length)
 Selects hash algorithm to use.

CYFER_HASH_CTXCYFER_Hash_Init (int type)
 Creates and initializes algorithm context.

void CYFER_Hash_Update (CYFER_HASH_CTX *ctx, const unsigned char *data, size_t len)
 Processes a chunk of data.

void CYFER_Hash_Finish (CYFER_HASH_CTX *ctx, unsigned char *md)
 Finalizes the algorithm and returns the hash value.

int CYFER_Hash (int type, const unsigned char *data, size_t len, unsigned char *md)
 An utility function to calculate hash of one chunk of data.


Detailed Description

Hash (message digest) algorithm support.


Define Documentation

#define CYFER_HASH_ADLER32   5
 

#define CYFER_HASH_CRC32   7
 

#define CYFER_HASH_MD2   8
 

#define CYFER_HASH_MD4   1
 

#define CYFER_HASH_MD5   2
 

#define CYFER_HASH_NONE   0
 

#define CYFER_HASH_RMD160   4
 

#define CYFER_HASH_SHA1   3
 

#define CYFER_HASH_SHA256   9
 

#define CYFER_HASH_SNEFRU   6
 


Typedef Documentation

typedef void CYFER_HASH_CTX
 

Hash algorithm context.


Function Documentation

int CYFER_Hash int    type,
const unsigned char *    data,
size_t    len,
unsigned char *    md
 

An utility function to calculate hash of one chunk of data.

Parameters:
type An integer representing the hash algorithm to use
data Input data
len Input data length (in bytes)
md [output] A buffer for the resulting hash value (must be big enough to hold the value)

void CYFER_Hash_Finish CYFER_HASH_CTX   ctx,
unsigned char *    md
 

Finalizes the algorithm and returns the hash value.

Note:
The function also destroys and frees the hash context
Parameters:
ctx Algorithm context
md [output] A buffer for hash value (must be big enough to hold the value)

CYFER_Hash_t* CYFER_Hash_Get_Supported void   
 

Returns a list of supported hash algorithms.

CYFER_HASH_CTX* CYFER_Hash_Init int    type
 

Creates and initializes algorithm context.

Parameters:
type An integer representing hash algorithm to use
Returns:
An initialized hash context, or NULL in case of error

int CYFER_Hash_Select const char *    name,
size_t *    length
 

Selects hash algorithm to use.

Parameters:
name Hash algorithm name
length [output] Length of hash value (in bytes)
Returns:
An integer representing the selected algorithm

void CYFER_Hash_Update CYFER_HASH_CTX   ctx,
const unsigned char *    data,
size_t    len
 

Processes a chunk of data.

Parameters:
ctx Algorithm context
data Input to the hash algorithm
len Length of input data (in bytes)


Generated on Sun Sep 26 13:53:58 2004 for Cyfer by doxygen1.3-rc3