OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
gsSHA1.h
1/*
2 * sha1.h
3 *
4 * Description:
5 * This is the header file for code which implements the Secure
6 * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
7 * April 17, 1995.
8 *
9 * Many of the variable names in this code, especially the
10 * single character names, were used because those were the names
11 * used in the publication.
12 *
13 * Please read the file sha1.c for more information.
14 *
15 */
16
17#ifndef _SHA1_H_
18#define _SHA1_H_
19
20//#include <stdint.h>
21#include "gsCommon.h"
22/*
23 * If you do not have the ISO standard stdint.h header file, then you
24 * must typdef the following:
25 * name meaning
26 * uint32_t unsigned 32 bit integer
27 * uint8_t unsigned 8 bit integer (i.e., unsigned char)
28 * int_least16_t integer of >= 16 bits
29 *
30 */
31#ifndef _PS3
32 // these common types are defined in sony libs
33 typedef gsi_u32 uint32_t;
34 typedef gsi_u8 uint8_t;
35#endif
36
37typedef gsi_i16 int_least16_t;
38
39#ifndef _SHA_enum_
40#define _SHA_enum_
41enum
42{
43 shaSuccess = 0,
44 shaNull, /* Null pointer parameter */
45 shaInputTooLong, /* input data too long */
46 shaStateError /* called Input after Result */
47};
48#endif
49#define SHA1HashSize 20
50
51/*
52 * This structure will hold context information for the SHA-1
53 * hashing operation
54 */
55typedef struct SHA1Context
56{
57 uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
58
59 uint32_t Length_Low; /* Message length in bits */
60 uint32_t Length_High; /* Message length in bits */
61
62 /* Index into message block array */
63 int_least16_t Message_Block_Index;
64 uint8_t Message_Block[64]; /* 512-bit message blocks */
65
66 int Computed; /* Is the digest computed? */
67 int Corrupted; /* Is the message digest corrupted? */
69
70/*
71 * Function Prototypes
72 */
73
74#if defined(__cplusplus)
75extern "C"
76{
77#endif
78
79
80int SHA1Reset( SHA1Context *);
81int SHA1Input( SHA1Context *,
82 const uint8_t *,
83 unsigned int);
84int SHA1Result( SHA1Context *,
85 uint8_t Message_Digest[SHA1HashSize]);
86
87
88#if defined(__cplusplus)
89}
90#endif // extern "C"
91
92
93#endif
Definition gsSHA1.h:56