SHA-1

Implementation of the SHA-1 hashing function. More...

Detailed Description

Files

file  sha1.h
 SHA-1 interface definition.
 

Data Structures

struct  sha1_context
 SHA-1 algorithm context. More...
 

Macros

#define SHA1_DIGEST_LENGTH   (20)
 Length of SHA-1 digests in byte.
 
#define SHA1_BLOCK_LENGTH   (64)
 Length of SHA-1 block in byte.
 

Functions

void sha1_init (sha1_context *ctx)
 Initialize SHA-1 message digest context. More...
 
void sha1_update (sha1_context *ctx, const void *data, size_t len)
 Update the SHA-1 context with a portion of the message being hashed. More...
 
void sha1_final (sha1_context *ctx, void *digest)
 Finalizes the SHA-1 message digest. More...
 
void sha1 (void *digest, const void *data, size_t len)
 Calculate a SHA1 hash from the given data. More...
 
void sha1_init_hmac (sha1_context *ctx, const void *key, size_t key_length)
 Initialize SHA-1 message digest context with MAC. More...
 
void sha1_final_hmac (sha1_context *ctx, void *digest)
 Finalizes the SHA-1 message digest with MAC. More...
 

Function Documentation

void sha1 ( void *  digest,
const void *  data,
size_t  len 
)
Parameters
[out]digestResult location, must be 20 byte
[in]dataInput data
[in]lenLength of buf
void sha1_final ( sha1_context ctx,
void *  digest 
)
Parameters
[in]ctxPointer to the SHA-1 context
[out]digestResult location, must be 20 byte
void sha1_final_hmac ( sha1_context ctx,
void *  digest 
)
Parameters
[in]ctxPointer to the SHA-1 context
[out]digestResult location, must be 20 byte
void sha1_init ( sha1_context ctx)
Parameters
[in]ctxPointer to the SHA-1 context to initialize
void sha1_init_hmac ( sha1_context ctx,
const void *  key,
size_t  key_length 
)
Parameters
[in]ctxPointer to the SHA-1 context to initialize
[in]keyKey used in the HMAC-SHA1 computation
[in]key_lengthThe size in bytes of key
void sha1_update ( sha1_context ctx,
const void *  data,
size_t  len 
)
Parameters
[in]ctxPointer to the SHA-1 context to update
[in]dataInput data
[in]lenLength of data