]> git.ipfire.org Git - thirdparty/nettle.git/blame - ripemd160.h
Additional NEWS entries for nettle-3.0.
[thirdparty/nettle.git] / ripemd160.h
CommitLineData
fa121c39
AM
1/* ripemd160.h
2 *
3 * RIPEMD-160 hash function.
4 */
5
6/* nettle, low-level cryptographics library
7 *
8 * Copyright (C) 2011 Andres Mejia
9 *
10 * The nettle library is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or (at your
13 * option) any later version.
14 *
15 * The nettle library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with the nettle library; see the file COPYING.LIB. If not, write to
ee6ff2cc
NM
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 * MA 02111-1301, USA.
fa121c39
AM
24 */
25
26#ifndef NETTLE_RIPEMD160_H_INCLUDED
27#define NETTLE_RIPEMD160_H_INCLUDED
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "nettle-types.h"
34
35/* Name mangling */
36#define ripemd160_init nettle_ripemd160_init
37#define ripemd160_update nettle_ripemd160_update
38#define ripemd160_digest nettle_ripemd160_digest
39
40/* RIPEMD160 */
41
42#define RIPEMD160_DIGEST_SIZE 20
43#define RIPEMD160_DATA_SIZE 64
44
45/* Digest is kept internally as 5 32-bit words. */
46#define _RIPEMD160_DIGEST_LENGTH 5
47
48struct ripemd160_ctx
49{
8cb0fdef 50 uint32_t state[_RIPEMD160_DIGEST_LENGTH];
cb83bd33 51 uint64_t count; /* 64-bit block count */
fa121c39
AM
52 uint8_t block[RIPEMD160_DATA_SIZE];
53 unsigned int index;
54};
55
56void
57ripemd160_init(struct ripemd160_ctx *ctx);
58
59void
60ripemd160_update(struct ripemd160_ctx *ctx,
b8bfc32f 61 size_t length,
fa121c39
AM
62 const uint8_t *data);
63
64void
65ripemd160_digest(struct ripemd160_ctx *ctx,
b8bfc32f 66 size_t length,
fa121c39
AM
67 uint8_t *digest);
68
69/* Internal compression function. STATE points to 5 uint32_t words,
70 and DATA points to 64 bytes of input data, possibly unaligned. */
71void
72_nettle_ripemd160_compress(uint32_t *state, const uint8_t *data);
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif /* NETTLE_RIPEMD160_H_INCLUDED */