]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/random/YarrowCoreLib/src/sha1mod.h
xnu-517.tar.gz
[apple/xnu.git] / bsd / dev / random / YarrowCoreLib / src / sha1mod.h
1 /*
2 * Copyright (c) 1999, 2000-2001 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25
26 /*
27 SHA-1 in C
28 By Steve Reid <steve@edmweb.com>
29 100% Public Domain
30 */
31 /* Header portion split from main code for convenience (AYB 3/02/98) */
32
33 #ifndef __SHA1_H__
34
35 #define __SHA1_H__
36
37 /*
38 Test Vectors (from FIPS PUB 180-1)
39 "abc"
40 A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
41 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
42 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
43 A million repetitions of "a"
44 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
45 */
46
47 /* Apple change - define this in the source file which uses it */
48 /* #define LITTLE_ENDIAN This should be #define'd if true. */
49 #define SHA1HANDSOFF /* Copies data before messing with it. */
50
51 //Context declaration
52 typedef struct {
53 unsigned long state[5];
54 unsigned long count[2];
55 unsigned char buffer[64];
56 } SHA1_CTX;
57
58 //Function forward declerations
59 void SHA1Transform(unsigned long state[5], unsigned char buffer[64]);
60 void SHA1Init(SHA1_CTX* context);
61 void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len);
62 void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
63
64 #endif /* __SHA1_H__ */