1 /* sha.h - Declaration of functions and datatypes for SHA1 sum computing
4 Copyright (C) 1999, Scott G. Miller
13 /* Structure to save state of computation between the single steps. */
28 /* Starting with the result of former calls of this function (or the
29 initialization function update the context for the next LEN bytes
31 It is necessary that LEN is a multiple of 64!!! */
32 extern void sha_process_block
__P ((const void *buffer
, size_t len
,
33 struct sha_ctx
*ctx
));
35 /* Starting with the result of former calls of this function (or the
36 initialization function update the context for the next LEN bytes
38 It is NOT required that LEN is a multiple of 64. */
39 extern void sha_process_bytes
__P((const void *buffer
, size_t len
,
40 struct sha_ctx
*ctx
));
42 /* Initialize structure containing state of computation. */
43 extern void sha_init_ctx
__P ((struct sha_ctx
*ctx
));
45 /* Process the remaining bytes in the buffer and put result from CTX
46 in first 16 bytes following RESBUF. The result is always in little
47 endian byte order, so that a byte-wise output yields to the wanted
48 ASCII representation of the message digest.
50 IMPORTANT: On some systems it is required that RESBUF is correctly
51 aligned for a 32 bits value. */
52 extern void *sha_finish_ctx
__P ((struct sha_ctx
*ctx
, void *resbuf
));
55 /* Put result from CTX in first 16 bytes following RESBUF. The result is
56 always in little endian byte order, so that a byte-wise output yields
57 to the wanted ASCII representation of the message digest.
59 IMPORTANT: On some systems it is required that RESBUF is correctly
60 aligned for a 32 bits value. */
61 extern void *sha_read_ctx
__P ((const struct sha_ctx
*ctx
, void *resbuf
));
64 /* Compute MD5 message digest for bytes read from STREAM. The
65 resulting message digest number will be written into the 16 bytes
66 beginning at RESBLOCK. */
67 extern int sha_stream
__P ((FILE *stream
, void *resblock
));
69 /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
70 result is always in little endian byte order, so that a byte-wise
71 output yields to the wanted ASCII representation of the message
73 extern void *sha_buffer
__P ((const char *buffer
, size_t len
, void *resblock
));