]> jfr.im git - irc/quakenet/newserv.git/blame - lib/sha1.h
A4STATS: remove E style escapes and switch to createtable for indices
[irc/quakenet/newserv.git] / lib / sha1.h
CommitLineData
18f8bd28
CP
1/* $OpenBSD: sha1.h,v 1.16 2004/01/22 21:48:02 espie Exp $ */
2
3/*
4 * SHA-1 in C
5 * By Steve Reid <steve@edmweb.com>
6 * 100% Public Domain
7 */
8
9#ifndef _SHA1_H
10#define _SHA1_H
11
12#include <sys/types.h>
13
14typedef struct {
15 u_int32_t state[5];
16 u_int32_t count[2];
17 unsigned char buffer[64];
18} SHA1_CTX;
19
20#include <sys/cdefs.h>
21
22__BEGIN_DECLS
23void SHA1Transform(u_int32_t [5], const unsigned char [64]);
24void SHA1Init(SHA1_CTX *);
25void SHA1Update(SHA1_CTX *, const unsigned char *, unsigned int);
26void SHA1Final(unsigned char [20], SHA1_CTX *);
27char *SHA1End(SHA1_CTX *, char *);
28char *SHA1File(char *, char *);
29char *SHA1Data(const unsigned char *, size_t, char *);
30__END_DECLS
31
32#define SHA1_DIGESTSIZE 20
33#define SHA1_BLOCKSIZE 64
34#define HTONDIGEST(x) do { \
35 x[0] = htonl(x[0]); \
36 x[1] = htonl(x[1]); \
37 x[2] = htonl(x[2]); \
38 x[3] = htonl(x[3]); \
39 x[4] = htonl(x[4]); } while (0)
40
41#define NTOHDIGEST(x) do { \
42 x[0] = ntohl(x[0]); \
43 x[1] = ntohl(x[1]); \
44 x[2] = ntohl(x[2]); \
45 x[3] = ntohl(x[3]); \
46 x[4] = ntohl(x[4]); } while (0)
47
48#endif /* _SHA1_H */