?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*********************************************************************
2 *
3 * Hash Function Library Headers
4 *
5 *********************************************************************
6 * FileName: Hashes.h
7 * Dependencies: None
8 * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32
9 * Compiler: Microchip C32 v1.05 or higher
10 * Microchip C30 v3.12 or higher
11 * Microchip C18 v3.30 or higher
12 * HI-TECH PICC-18 PRO 9.63PL2 or higher
13 * Company: Microchip Technology, Inc.
14 *
15 * Software License Agreement
16 *
17 * Copyright (C) 2002-2009 Microchip Technology Inc. All rights
18 * reserved.
19 *
20 * Microchip licenses to you the right to use, modify, copy, and
21 * distribute:
22 * (i) the Software when embedded on a Microchip microcontroller or
23 * digital signal controller product ("Device") which is
24 * integrated into Licensee's product; or
25 * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h,
26 * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device
27 * used in conjunction with a Microchip ethernet controller for
28 * the sole purpose of interfacing with the ethernet controller.
29 *
30 * You should refer to the license agreement accompanying this
31 * Software for additional information regarding your rights and
32 * obligations.
33 *
34 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
35 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
36 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
37 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
38 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
39 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
40 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
41 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
42 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
43 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
44 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
45 *
46 * IMPORTANT: The implementation and use of third party algorithms,
47 * specifications and/or other technology may require a license from
48 * various third parties. It is your responsibility to obtain
49 * information regarding any applicable licensing obligations.
50 *
51 *
52 * Author Date Comment
53 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54 * Elliott Wood 05/01/07 Original
55 ********************************************************************/
56  
57 #ifndef __HASHES_H
58 #define __HASHES_H
59  
60 /****************************************************************************
61 Section:
62 Data Types
63 ***************************************************************************/
64  
65 // Type of hash being calculated
66 typedef enum
67 {
68 HASH_MD5 = 0u, // MD5 is being calculated
69 HASH_SHA1 // SHA-1 is being calculated
70 } HASH_TYPE;
71  
72 // Context storage for a hash operation
73 typedef struct
74 {
75 DWORD h0; // Hash state h0
76 DWORD h1; // Hash state h1
77 DWORD h2; // Hash state h2
78 DWORD h3; // Hash state h3
79 DWORD h4; // Hash state h4
80 DWORD bytesSoFar; // Total number of bytes hashed so far
81 BYTE partialBlock[64]; // Beginning of next 64 byte block
82 HASH_TYPE hashType; // Type of hash being calculated
83 } HASH_SUM;
84  
85  
86 /****************************************************************************
87 Section:
88 Function Prototypes
89 ***************************************************************************/
90  
91 #if defined(STACK_USE_SHA1)
92 void SHA1Initialize(HASH_SUM* theSum);
93 void SHA1AddData(HASH_SUM* theSum, BYTE* data, WORD len);
94 void SHA1Calculate(HASH_SUM* theSum, BYTE* result);
95 #if defined(__18CXX)
96 void SHA1AddROMData(HASH_SUM* theSum, ROM BYTE* data, WORD len);
97 #else
98 // Non-ROM variant for C30 / C32
99 #define SHA1AddROMData(a,b,c) SHA1AddData(a,(BYTE*)b,c)
100 #endif
101 #endif
102  
103 #if defined(STACK_USE_MD5)
104 void MD5Initialize(HASH_SUM* theSum);
105 void MD5AddData(HASH_SUM* theSum, BYTE* data, WORD len);
106 void MD5Calculate(HASH_SUM* theSum, BYTE* result);
107 #if defined(__18CXX)
108 void MD5AddROMData(HASH_SUM* theSum, ROM BYTE* data, WORD len);
109 #else
110 // Non-ROM variant for C30 / C32
111 #define MD5AddROMData(a,b,c) MD5AddData(a,(BYTE*)b,c)
112 #endif
113 #endif
114  
115 void HashAddData(HASH_SUM* theSum, BYTE* data, WORD len);
116 #if defined(__18CXX)
117 void HashAddROMData(HASH_SUM* theSum, ROM BYTE* data, WORD len);
118 #else
119 // Non-ROM variant for C30 / C32
120 #define HashAddROMData(a,b,c) HashAddData(a,(BYTE*)b,c)
121 #endif
122  
123 #endif
124  
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3