blob: 3d357506e7d8a875ba5cbce0dc6d965be31091be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#ifndef SHA1_H
#define SHA1_H
/*
SHA-1 in C
By Steve Reid <steve@edmweb.com>
100% Public Domain
adopted for s/qmail (feh)
*/
#include <stdint.h>
/* SHA1 implementation */
#define SHA1_BLOCKSIZE 64
#define SHA1_DIGESTSIZE 20
typedef struct {
uint32_t state[5];
uint32_t count[2];
uint8_t buffer[SHA1_BLOCKSIZE];
} sha1_ctx;
void sha1_init(sha1_ctx *context);
void sha1_update(sha1_ctx *context, const uint8_t *data, uint32_t len);
void sha1_final(uint8_t hash[SHA1_DIGESTSIZE], sha1_ctx *context);
void sha1_transform(uint32_t state[5], const uint8_t buffer[SHA1_BLOCKSIZE]);
void sha1_hash(char *hash, const char *data, uint32_t len);
#endif /* SHA1_H */
|