123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- #ifndef SHA1_H
- # define SHA1_H 1
- #include <stdio.h>
- #if defined HAVE_LIMITS_H || _LIBC
- # include <limits.h>
- #endif
- #include "ansidecl.h"
- #ifdef _LIBC
- # include <sys/types.h>
- typedef u_int32_t sha1_uint32;
- typedef uintptr_t sha1_uintptr;
- #elif defined (HAVE_SYS_TYPES_H) && defined (HAVE_STDINT_H)
- #include <stdint.h>
- #include <sys/types.h>
- typedef uint32_t sha1_uint32;
- typedef uintptr_t sha1_uintptr;
- #else
- # define INT_MAX_32_BITS 2147483647
- # ifndef INT_MAX
- # define INT_MAX INT_MAX_32_BITS
- # endif
- # if INT_MAX == INT_MAX_32_BITS
- typedef unsigned int sha1_uint32;
- # else
- # if SHRT_MAX == INT_MAX_32_BITS
- typedef unsigned short sha1_uint32;
- # else
- # if LONG_MAX == INT_MAX_32_BITS
- typedef unsigned long sha1_uint32;
- # else
-
- "Cannot determine unsigned 32-bit data type."
- # endif
- # endif
- # endif
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- struct sha1_ctx
- {
- sha1_uint32 A;
- sha1_uint32 B;
- sha1_uint32 C;
- sha1_uint32 D;
- sha1_uint32 E;
- sha1_uint32 total[2];
- sha1_uint32 buflen;
- sha1_uint32 buffer[32];
- };
- extern void sha1_init_ctx (struct sha1_ctx *ctx);
- extern void sha1_process_block (const void *buffer, size_t len,
- struct sha1_ctx *ctx);
- extern void sha1_process_bytes (const void *buffer, size_t len,
- struct sha1_ctx *ctx);
- extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
- extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
- extern int sha1_stream (FILE *stream, void *resblock);
- extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
- #ifdef __cplusplus
- }
- #endif
- #endif
|