PandA-2024.02
sha_driver.c
Go to the documentation of this file.
1 /*
2 +--------------------------------------------------------------------------+
3 | CHStone : a suite of benchmark programs for C-based High-Level Synthesis |
4 | ======================================================================== |
5 | |
6 | * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, |
7 | H. Takada and K. Ishii |
8 | Nagoya University, Japan |
9 | |
10 | * Remark : |
11 | 1. This source code is modified to unify the formats of the benchmark |
12 | programs in CHStone. |
13 | 2. Test vectors are added for CHStone. |
14 | 3. If "main_result" is 0 at the end of the program, the program is |
15 | correctly executed. |
16 | 4. Please follow the copyright of each benchmark program. |
17 +--------------------------------------------------------------------------+
18 */
19 /* NIST Secure Hash Algorithm */
20 /* heavily modified by Uwe Hollerbach uh@alumni.caltech edu */
21 /* from Peter C. Gutmann's implementation as found in */
22 /* Applied Cryptography by Bruce Schneier */
23 
24 /* NIST's proposed modification to SHA of 7/11/94 may be */
25 /* activated by defining USE_MODIFIED_SHA */
26 
27 #include <stdio.h>
28 #include "sha.h"
29 #include "sha.c"
30 
31 /*
32 +--------------------------------------------------------------------------+
33 | * Test Vector (added for CHStone) |
34 | outData : expected output data |
35 +--------------------------------------------------------------------------+
36 */
37 const INT32 outData[5] =
38  { 0x006a5a37UL, 0x93dc9485UL, 0x2c412112UL, 0x63f7ba43UL, 0xad73f922UL };
39 
40 int
41 main ()
42 {
43  int i;
44  int main_result;
45  main_result = 0;
46  sha_stream ();
47 
48  for (i = 0; i < 5; i++)
49  {
50 
51  main_result += (sha_info_digest[i] != outData[i]);
52  }
53  printf ("%d\n", main_result);
54 
55  return main_result;
56  }
int main()
Definition: sha_driver.c:41
INT32 sha_info_digest[5]
Definition: sha.h:32
int main_result
Definition: mips.c:38
unsigned int INT32
Definition: sha.h:28
void sha_stream()
Definition: sha.c:204
const INT32 outData[5]
Definition: sha_driver.c:37

Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by doxygen 1.8.13