Pyrogenesis  trunk
sha.h
Go to the documentation of this file.
1 /* Copyright (C) 2013 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef SHA_INCLUDED
19 #define SHA_INCLUDED
20 
21 #define SHA_DIGEST_SIZE 32
22 
23 /**
24  * Structure for performing SHA256 encryption on arbitrary data
25  */
26 struct SHA256
27 {
28  unsigned int total[2];
29  unsigned int state[8];
30  unsigned char buffer[64];
31 
32  SHA256();
33  void init();
34  void transform(unsigned char (&data)[64]);
35  void update(const void* input, unsigned int len);
36  void finish(unsigned char (&digest)[32]);
37 };
38 
39 #endif // SHA_INCLUDED
void finish(unsigned char(&digest)[32])
Definition: sha.cpp:238
unsigned int total[2]
Definition: sha.h:28
void update(const void *input, unsigned int len)
Definition: sha.cpp:191
void transform(unsigned char(&data)[64])
Definition: sha.cpp:60
Structure for performing SHA256 encryption on arbitrary data.
Definition: sha.h:26
SHA256()
Definition: sha.cpp:41
unsigned char buffer[64]
Definition: sha.h:30
void init()
Definition: sha.cpp:45
unsigned int state[8]
Definition: sha.h:29
input
Definition: tests.py:115