123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #ifndef SHA512_H
- # define SHA512_H 1
- # include <stdio.h>
- # include "u64.h"
- # ifdef __cplusplus
- extern "C" {
- # endif
- struct sha512_ctx
- {
- u64 state[8];
- u64 total[2];
- size_t buflen;
- u64 buffer[32];
- };
- enum { SHA384_DIGEST_SIZE = 384 / 8 };
- enum { SHA512_DIGEST_SIZE = 512 / 8 };
- extern void sha512_init_ctx (struct sha512_ctx *ctx);
- extern void sha384_init_ctx (struct sha512_ctx *ctx);
- extern void sha512_process_block (const void *buffer, size_t len,
- struct sha512_ctx *ctx);
- extern void sha512_process_bytes (const void *buffer, size_t len,
- struct sha512_ctx *ctx);
- extern void *sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf);
- extern void *sha384_finish_ctx (struct sha512_ctx *ctx, void *resbuf);
- extern void *sha512_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
- extern void *sha384_read_ctx (const struct sha512_ctx *ctx, void *resbuf);
- extern int sha512_stream (FILE *stream, void *resblock);
- extern int sha384_stream (FILE *stream, void *resblock);
- extern void *sha512_buffer (const char *buffer, size_t len, void *resblock);
- extern void *sha384_buffer (const char *buffer, size_t len, void *resblock);
- # ifdef __cplusplus
- }
- # endif
- #endif
|