]> the.earth.li Git - onak.git/blob - sha1x.h
Bump debhelper compat level to 13
[onak.git] / sha1x.h
1 /*
2  * sha1x.h - Double width SHA-1 as per PGP 5.5
3  *
4  * Copyright 2013 Jonathan McDowell <noodles@earth.li>
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  */
15
16 #ifndef __SHA1X_H__
17 #define __SHA1X_H__
18
19 #include <stdbool.h>
20 #include <stdint.h>
21
22 #ifdef HAVE_NETTLE
23 #include <nettle/sha.h>
24 #else
25 #include "sha1.h"
26 #endif
27
28 #define SHA1X_DIGEST_SIZE (2 * SHA1_DIGEST_SIZE)
29
30 struct sha1x_ctx {
31         struct sha1_ctx a, b, c, d;
32         bool odd;
33         unsigned char result[SHA1X_DIGEST_SIZE];
34 };
35
36 void sha1x_init(struct sha1x_ctx *ctx);
37 void sha1x_update(struct sha1x_ctx *ctx, unsigned length, const uint8_t *data);
38 void sha1x_digest(struct sha1x_ctx *ctx, unsigned length, uint8_t *digest);
39
40 #endif /* __SHA1X_H__ */