sha512.h File Reference

Interface to a SHA-512 implementation. More...

#include <stddef.h>
#include <stdint.h>

Macros

#define SHA512_BLOCK_SIZE   (128)
 block size
 
#define SHA512_DIGEST_SIZE   (64)
 digest size
 
#define SHA512_DIGEST_WORDS   (8)
 number of words in SHA state
 

Functions

void tinysha512_init (sha512_state *s)
 The SHA state. More...
 
void tinysha512_update (sha512_state *s, void const *data, size_t data_length)
 Hashes data into state using SHA-512. More...
 
void tinysha512_final (unsigned char *digest, sha512_state *s)
 Computes the SHA-512 hash in the digest buffer. More...
 

Detailed Description

Interface to a SHA-512 implementation.

Function Documentation

◆ tinysha512_final()

void tinysha512_final ( unsigned char *  digest,
sha512_state *  s 
)

Computes the SHA-512 hash in the digest buffer.

Note
Assumes SHA512_DIGEST_SIZE bytes are available to accept the digest.
Warning
The state buffer 'leftover' is left in memory after processing. If your application intends to have sensitive data in this buffer, remember to erase it after the data has been processed
Parameters
[out]digestThe computed digest. Must be non-null or behavior is undefined.
[in]sThe hash state. Must be non-null or behavior is undefined.

◆ tinysha512_init()

void tinysha512_init ( sha512_state *  s)

The SHA state.

Initializes the hash state

Parameters
[in,out]sThe hash state to initialize.

◆ tinysha512_update()

void tinysha512_update ( sha512_state *  s,
void const *  data,
size_t  data_length 
)

Hashes data into state using SHA-512.

Warning
The state buffer 'leftover' is left in memory after processing. If your application intends to have sensitive data in this buffer, remember to erase it after the data has been processed
Parameters
[in,out]sThe hash state. Must be non-null or behavior is undefined.
[in]dataThe data to hash into s.
[in]data_lengthThe size of data in bytes.