summaryrefslogtreecommitdiffstats
path: root/sha256.h
blob: fa98d42c1fcadfbd248ea6a5aea2143f34521ff8 (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
/*
 * An implementation of the SHA-256 hash function, this is endian neutral
 * so should work just about anywhere.
 *
 * Revised Code:  Complies to SHA-256 standard now.
 *
 * Tom St Denis -- http://tomstdenis.home.dhs.org
 */

#ifndef _SHA256_
#define _SHA256_

#include "uint.h"

#define SHA256_DIGEST_SIZE 32

struct sha256_ctx{
    unsigned long state[8], length, curlen;
    unsigned char buf[64];
};

void sha256_init(void *ctx);

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

void sha256_final(void *ctx, u8 *out);

#endif