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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/* sha512.h
* Copyright (C) 2007 Tillmann Werner <tillmann.werner@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License Version 2 as
* published by the Free Software Foundation. You may not use, modify or
* distribute this program under any other version of the GNU General
* Public License.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This code is based on the SHA-512 code by Jean-Luc Cooke <jlcooke@certainkey.com>
*
*
* $Id$
*/
#ifndef _NEBULA_SHA512_H
#define _NEBULA_SHA512_H
#include <string.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#define ROLuns64(a,b) ( ((a) << ((b) & 63)) | ((a) >> (64-((b) & 63))) )
#define RORuns64(a,b) ( ((a) >> ((b) & 63)) | ((a) << (64-((b) & 63))) )
typedef struct {
u_int64_t state[8];
u_char buf[128];
u_int32_t count[4];
} sha512_context;
extern void sha512_init(sha512_context *c);
extern void sha512_update(sha512_context *c, u_char *input, unsigned int inLen);
extern void sha512_final(u_char *digest, sha512_context *c);
char *mem_sha512sum(u_char *msg, u_int32_t len);
#endif
|