summaryrefslogtreecommitdiffstats
path: root/sha512.h
blob: 41161ec421e1c29c8bda03cf94503b090ae28642 (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
31
32
33
34
35
36
/* SHA-512 code by Jean-Luc Cooke <jlcooke@certainkey.com>
 *
 * Copyright (c) Jean-Luc Cooke <jlcooke@certainkey.com>
 * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>
 * Copyright (c) 2003 Kyle McMartin <kyle@debian.org>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 */
#ifndef _SHA512_
#define _SHA512_

#include "uint.h"

#define SHA384_DIGEST_SIZE 48
#define SHA512_DIGEST_SIZE 64
#define SHA384_HMAC_BLOCK_SIZE  96
#define SHA512_HMAC_BLOCK_SIZE 128

struct sha512_ctx {
	u64 state[8];
	u32 count[4];
	u8 buf[128];
};
void sha512_init(void *ctx);
void sha384_init(void *ctx);

void sha512_update(void *ctx, const u8 *data, unsigned int len);

void sha512_final(void *ctx, u8 *hash);
void sha384_final(void *ctx, u8 *hash);

#endif