sha1.h

SHA-1 interface definition.

SHA1_DIGEST_LENGTH

Length of SHA-1 digests in byte.

1
(20)
SHA1_BLOCK_LENGTH

Length of SHA-1 block in byte.

1
(64)
void sha1_init(sha1_context * ctx)

Initialize SHA-1 message digest context.

Parameters

ctx:Pointer to the SHA-1 context to initialize

void sha1_update(sha1_context * ctx, const void * data, msp430_types.h::size_t len)

Update the SHA-1 context with a portion of the message being hashed.

Parameters

ctx:Pointer to the SHA-1 context to update
data:Input data
len:Length of data

void sha1_final(sha1_context * ctx, void * digest)

Finalizes the SHA-1 message digest.

Parameters

ctx:Pointer to the SHA-1 context
digest:Result location, must be 20 byte

void sha1(void * digest, const void * data, msp430_types.h::size_t len)

Calculate a SHA1 hash from the given data.

Parameters

digest:Result location, must be 20 byte
data:Input data
len:Length of buf

void sha1_init_hmac(sha1_context * ctx, const void * key, msp430_types.h::size_t key_length)

Initialize SHA-1 message digest context with MAC.

Parameters

ctx:Pointer to the SHA-1 context to initialize
key:Key used in the HMAC-SHA1 computation
key_length:The size in bytes of key

void sha1_final_hmac(sha1_context * ctx, void * digest)

Finalizes the SHA-1 message digest with MAC.

Parameters

ctx:Pointer to the SHA-1 context
digest:Result location, must be 20 byte

struct sha1_context

SHA-1 algorithm context.

uint32_t buffer()

internal buffer

uint32_t state()

buffering current state of hashing

uint32_t byte_count

already processed bytes

uint8_t buffer_offset

internal state variable to keep track if the buffer is filled before proceeding to hash this block

uint8_t key_buffer()

internal state of the key buffer

uint8_t inner_hash()

temporary buffer for the inner hashing