]>
git.ipfire.org Git - thirdparty/bird.git/blob - lib/sha256.h
2 * BIRD Library -- SHA-256 and SHA-224 Hash Functions
4 * (c) 2015 CZ.NIC z.s.p.o.
6 * Based on the code from libgcrypt-1.6.0, which is
7 * (c) 2003, 2006, 2008, 2009 Free Software Foundation, Inc.
9 * Can be freely distributed and used under the terms of the GNU GPL.
12 #ifndef _BIRD_SHA256_H_
13 #define _BIRD_SHA256_H_
15 #include "nest/bird.h"
18 #define SHA224_SIZE 28
19 #define SHA224_HEX_SIZE 57
20 #define SHA224_BLOCK_SIZE 64
22 #define SHA256_SIZE 32
23 #define SHA256_HEX_SIZE 65
24 #define SHA256_BLOCK_SIZE 64
29 struct sha256_context
{
30 u32 h0
, h1
, h2
, h3
, h4
, h5
, h6
, h7
;
31 byte buf
[SHA256_BLOCK_SIZE
];
36 #define sha224_context sha256_context
39 void sha256_init(struct hash_context
*ctx
);
40 void sha224_init(struct hash_context
*ctx
);
42 void sha256_update(struct hash_context
*ctx
, const byte
*buf
, uint len
);
43 #define sha224_update sha256_update
45 byte
*sha256_final(struct hash_context
*ctx
);
46 #define sha224_final sha256_final
49 #endif /* _BIRD_SHA256_H_ */