File: sha256.h

package info (click to toggle)
ocaml-sha 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 160 kB
  • ctags: 230
  • sloc: ansic: 757; ml: 258; makefile: 88
file content (32 lines) | stat: -rw-r--r-- 970 bytes parent folder | download
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
/*
 *	Copyright (C) 2006-2008 Vincent Hanquez <tab@snarc.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; version 2 only.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * SHA256 implementation
 */
#ifndef SHA256_H
#define SHA256_H

struct sha256_ctx
{
	unsigned int h[8];
	unsigned char buf[128];
	unsigned long long sz;
};

typedef struct { unsigned int digest[8]; } sha256_digest;

void sha256_init(struct sha256_ctx *ctx);
void sha256_update(struct sha256_ctx *ctx, unsigned char *data, int len);
void sha256_finalize(struct sha256_ctx *ctx, sha256_digest *out);
void sha256_to_hex(sha256_digest *digest, char *out);

#endif