[BACK]Return to sha1.h CVS log [TXT][DIR] Up to [local] / src / include

Annotation of src/include/sha1.h, Revision 1.13

1.12      avsm        1: /*     $OpenBSD: sha1.h,v 1.11 2002/12/23 04:33:31 millert Exp $       */
1.5       millert     2:
                      3: /*
                      4:  * SHA-1 in C
                      5:  * By Steve Reid <steve@edmweb.com>
                      6:  * 100% Public Domain
                      7:  */
1.1       millert     8:
1.2       millert     9: #ifndef _SHA1_H
                     10: #define _SHA1_H
                     11:
1.1       millert    12: typedef struct {
1.5       millert    13:     u_int32_t state[5];
1.11      millert    14:     u_int32_t count[2];
1.5       millert    15:     u_char buffer[64];
                     16: } SHA1_CTX;
1.11      millert    17:
                     18: #include <sys/cdefs.h>
                     19:
                     20: __BEGIN_DECLS
1.10      millert    21: void SHA1Transform(u_int32_t state[5], const u_char buffer[64]);
                     22: void SHA1Init(SHA1_CTX *context);
                     23: void SHA1Update(SHA1_CTX *context, const u_char *data, u_int len);
                     24: void SHA1Final(u_char digest[20], SHA1_CTX *context);
                     25: char *SHA1End(SHA1_CTX *, char *);
                     26: char *SHA1File(char *, char *);
1.13    ! avsm       27: char *SHA1Data(const u_char *, size_t, char *);
1.11      millert    28: __END_DECLS
1.9       angelos    29:
                     30: #define SHA1_DIGESTSIZE       20
                     31: #define SHA1_BLOCKSIZE        64
1.11      millert    32: #define HTONDIGEST(x) do {                                              \
                     33:         x[0] = htonl(x[0]);                                             \
                     34:         x[1] = htonl(x[1]);                                             \
                     35:         x[2] = htonl(x[2]);                                             \
                     36:         x[3] = htonl(x[3]);                                             \
                     37:         x[4] = htonl(x[4]); } while (0)
                     38:
                     39: #define NTOHDIGEST(x) do {                                              \
                     40:         x[0] = ntohl(x[0]);                                             \
                     41:         x[1] = ntohl(x[1]);                                             \
                     42:         x[2] = ntohl(x[2]);                                             \
                     43:         x[3] = ntohl(x[3]);                                             \
                     44:         x[4] = ntohl(x[4]); } while (0)
1.2       millert    45:
                     46: #endif /* _SHA1_H */