-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsha512.h
42 lines (31 loc) · 1.17 KB
/
sha512.h
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
/* sha512.h
* Copyright (C) 2007 Tillmann Werner <[email protected]>
*
* This file is free software; as a special exception the author gives
* unlimited permission to copy and/or distribute it, with or without
* modifications, as long as this notice is preserved.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* This code is based on the SHA-512 code by Jean-Luc Cooke <[email protected]>
*/
#ifndef SHA512_H
#define 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