LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
sha.h
Go to the documentation of this file.
1/*
2 * sha.h
3 *
4 * Originally taken from the public domain SHA1 implementation
5 * written by by Steve Reid <steve@edmweb.com>
6 *
7 * Modified by Aaron D. Gifford <agifford@infowest.com>
8 *
9 * NO COPYRIGHT - THIS IS 100% IN THE PUBLIC DOMAIN
10 *
11 * The original unmodified version is available at:
12 * ftp://ftp.funet.fi/pub/crypt/hash/sha/sha1.c
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef __SHA1_H__
28#define __SHA1_H__
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* Define this if your machine is LITTLE_ENDIAN, otherwise #undef it: */
35#undef LITTLE_ENDIAN
36
37/* Make sure you define these types for your architecture: */
38typedef unsigned int sha1_quadbyte; /* 4 byte type */
39typedef unsigned char sha1_byte; /* single byte type */
40
41/*
42 * Be sure to get the above definitions right. For instance, on my
43 * x86 based FreeBSD box, I define LITTLE_ENDIAN and use the type
44 * "unsigned long" for the quadbyte. On FreeBSD on the Alpha, however,
45 * while I still use LITTLE_ENDIAN, I must define the quadbyte type
46 * as "unsigned int" instead.
47 */
48
49#define SHA1_BLOCK_LENGTH 64
50#define SHA1_DIGEST_LENGTH 20
51
52/* The SHA1 structure: */
53typedef struct _SHA_CTX {
58
59#ifndef NOPROTO
60void SHA1_Init(SHA_CTX *context);
61void SHA1_Update(SHA_CTX *context, sha1_byte *data, unsigned int len);
62void SHA1_Final(sha1_byte digest[SHA1_DIGEST_LENGTH], SHA_CTX* context);
63#else
64void SHA1_Init();
65void SHA1_Update();
66void SHA1_Final();
67#endif
68
69#ifdef __cplusplus
70}
71#endif
72
73#endif
74
#define SHA1_BLOCK_LENGTH
Definition: sha.h:49
#define SHA1_DIGEST_LENGTH
Definition: sha.h:50
void SHA1_Final(sha1_byte digest[SHA1_DIGEST_LENGTH], SHA_CTX *context)
Definition: sha1.c:131
void SHA1_Update(SHA_CTX *context, sha1_byte *data, unsigned int len)
Definition: sha1.c:111
void SHA1_Init(SHA_CTX *context)
Definition: sha1.c:100
unsigned int sha1_quadbyte
Definition: sha.h:38
struct _SHA_CTX SHA_CTX
unsigned char sha1_byte
Definition: sha.h:39
Definition: sha.h:53
sha1_byte buffer[SHA1_BLOCK_LENGTH]
Definition: sha.h:56
sha1_quadbyte count[2]
Definition: sha.h:55
sha1_quadbyte state[5]
Definition: sha.h:54
union @15 data