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

Detailed Description

Implementation of the SHA-1 hashing function.

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

◆ sha1()

void sha1 ( void *  digest,
const void *  data,
size_t  len 
)

Calculate a SHA1 hash from the given data.

Parameters
[out]digestResult location, must be 20 byte
[in]dataInput data
[in]lenLength of buf

◆ sha1_final()

void sha1_final ( sha1_context ctx,
void *  digest 
)

Finalizes the SHA-1 message digest.

Parameters
[in]ctxPointer to the SHA-1 context
[out]digestResult location, must be 20 byte

◆ sha1_final_hmac()

void sha1_final_hmac ( sha1_context ctx,
void *  digest 
)

Finalizes the SHA-1 message digest with MAC.

Parameters
[in]ctxPointer to the SHA-1 context
[out]digestResult location, must be 20 byte

◆ sha1_init()

void sha1_init ( sha1_context ctx)

Initialize SHA-1 message digest context.

Parameters
[in]ctxPointer to the SHA-1 context to initialize

◆ sha1_init_hmac()

void sha1_init_hmac ( sha1_context ctx,
const void *  key,
size_t  key_length 
)

Initialize SHA-1 message digest context with MAC.

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

◆ sha1_update()

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.

Parameters
[in]ctxPointer to the SHA-1 context to update
[in]dataInput data
[in]lenLength of data