123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- #ifndef __TC_SHA256_H__
- #define __TC_SHA256_H__
- #include <stddef.h>
- #include <stdint.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define TC_SHA256_BLOCK_SIZE (64)
- #define TC_SHA256_DIGEST_SIZE (32)
- #define TC_SHA256_STATE_BLOCKS (TC_SHA256_DIGEST_SIZE/4)
- struct tc_sha256_state_struct {
- unsigned int iv[TC_SHA256_STATE_BLOCKS];
- uint64_t bits_hashed;
- uint8_t leftover[TC_SHA256_BLOCK_SIZE];
- size_t leftover_offset;
- };
- typedef struct tc_sha256_state_struct *TCSha256State_t;
- int tc_sha256_init(TCSha256State_t s);
- int tc_sha256_update (TCSha256State_t s, const uint8_t *data, size_t datalen);
- int tc_sha256_final(uint8_t *digest, TCSha256State_t s);
- #ifdef __cplusplus
- }
- #endif
- #endif
|