#include <stdint.h>
Go to the source code of this file.
- Author
- Daniel Otte
- Date
- 2006-05-16 GPLv3 or later
#define SHA256_BLOCK_BITS 512 |
defines the size of a SHA-256 input block in bits
defines the size of a SHA-256 input block in bytes
#define SHA256_HASH_BITS 256 |
defines the size of a SHA-256 hash value in bits
defines the size of a SHA-256 hash value in bytes
void sha256 |
( |
sha256_hash_t * |
dest, |
|
|
const void * |
msg, |
|
|
uint32_t |
length_b |
|
) |
| |
simple SHA-256 hashing function for direct hashing
This function automaticaly hashes a given message of arbitary length with the SHA-256 hashing algorithm.
- Parameters
-
dest | pointer to the location where the hash value is going to be written to |
msg | pointer to the message thats going to be hashed |
length_b | length of the message in bits |
convert the hash state into the hash value This function reads the context and writes the hash value to the destination
- Parameters
-
dest | pointer to the location where the hash value should be written |
state | pointer to the SHA-256 hash context |
initialise a SHA-256 context
This function sets a sha256_ctx_t to the initial values for hashing.
- Parameters
-
state | pointer to the SHA-256 hashing context |
initialise a SHA-256 context
- Parameters
-
state | pointer to a sha256 context |
- Returns
- none
void sha256_lastBlock |
( |
sha256_ctx_t * |
state, |
|
|
const void * |
block, |
|
|
uint16_t |
length |
|
) |
| |
finalize the context with the given block
This function finalizes the SHA-256 hash context by processing the given block of variable length.
- Parameters
-
state | pointer to the SHA-256 hash context |
block | pointer to the block of fixed length (512 bit = 64 byte) |
length_b | the length of the block in bits |
finalize the context with the given block
- Parameters
-
state | Pointer to the context in which this block should be processed. |
block | Pointer to the message wich should be hashed. |
length | is the length of only THIS block in BITS not in bytes! bits are big endian, meaning high bits come first. if you have a message with bits at the end, the byte must be padded with zeros |
void sha256_nextBlock |
( |
sha256_ctx_t * |
state, |
|
|
const void * |
block |
|
) |
| |
update the context with a given block
This function updates the SHA-256 hash context by processing the given block of fixed length.
- Parameters
-
state | pointer to the SHA-256 hash context |
block | pointer to the block of fixed length (512 bit = 64 byte) |
block must be, 512, Bit = 64, Byte, long !!!