diff options
Diffstat (limited to 'Utilities/cmlibrhash/librhash/sha256.h')
-rw-r--r-- | Utilities/cmlibrhash/librhash/sha256.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Utilities/cmlibrhash/librhash/sha256.h b/Utilities/cmlibrhash/librhash/sha256.h new file mode 100644 index 0000000000..f87ebaa697 --- /dev/null +++ b/Utilities/cmlibrhash/librhash/sha256.h @@ -0,0 +1,32 @@ +/* sha.h sha256 and sha224 hash functions */ +#ifndef SHA256_H +#define SHA256_H +#include "ustd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define sha256_block_size 64 +#define sha256_hash_size 32 +#define sha224_hash_size 28 + +/* algorithm context */ +typedef struct sha256_ctx +{ + unsigned message[16]; /* 512-bit buffer for leftovers */ + uint64_t length; /* number of processed bytes */ + unsigned hash[8]; /* 256-bit algorithm internal hashing state */ + unsigned digest_length; /* length of the algorithm digest in bytes */ +} sha256_ctx; + +void rhash_sha224_init(sha256_ctx *ctx); +void rhash_sha256_init(sha256_ctx *ctx); +void rhash_sha256_update(sha256_ctx *ctx, const unsigned char* data, size_t length); +void rhash_sha256_final(sha256_ctx *ctx, unsigned char result[32]); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* SHA256_H */ |