1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #ifndef SHA256_H
- # define SHA256_H 1
- # include <stdio.h>
- # include <stdint.h>
- # ifdef __cplusplus
- extern "C" {
- # endif
- struct sha256_ctx
- {
- uint32_t state[8];
- uint32_t total[2];
- size_t buflen;
- uint32_t buffer[32];
- };
- enum { SHA224_DIGEST_SIZE = 224 / 8 };
- enum { SHA256_DIGEST_SIZE = 256 / 8 };
- extern void sha256_init_ctx (struct sha256_ctx *ctx);
- extern void sha224_init_ctx (struct sha256_ctx *ctx);
- extern void sha256_process_block (const void *buffer, size_t len,
- struct sha256_ctx *ctx);
- extern void sha256_process_bytes (const void *buffer, size_t len,
- struct sha256_ctx *ctx);
- extern void *sha256_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
- extern void *sha224_finish_ctx (struct sha256_ctx *ctx, void *resbuf);
- extern void *sha256_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
- extern void *sha224_read_ctx (const struct sha256_ctx *ctx, void *resbuf);
- extern int sha256_stream (FILE *stream, void *resblock);
- extern int sha224_stream (FILE *stream, void *resblock);
- extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
- extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
- # ifdef __cplusplus
- }
- # endif
- #endif
|