diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-11 15:50:46 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-11 15:50:46 +0000 |
commit | 14c7f45cdae826f88dc539c8c38dd95caf305731 (patch) | |
tree | 832da054b7cfb2dc6fd63339af736625f31d21aa /utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/sha1.h | |
parent | 7c84ede3781c27db73403bd6302f320c76a58c8c (diff) | |
download | rockbox-14c7f45cdae826f88dc539c8c38dd95caf305731.tar.gz rockbox-14c7f45cdae826f88dc539c8c38dd95caf305731.zip |
Add zook's ZenUtils to SVN
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18010 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/sha1.h')
-rwxr-xr-x | utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/sha1.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/sha1.h b/utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/sha1.h new file mode 100755 index 0000000000..a35c917fdd --- /dev/null +++ b/utils/zenutils/libraries/beecrypt-4.1.2/beecrypt/sha1.h | |||
@@ -0,0 +1,120 @@ | |||
1 | /* | ||
2 | * Copyright (c) 1997, 1998, 1999, 2000, 2002 Virtual Unlimited B.V. | ||
3 | * | ||
4 | * This library is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Lesser General Public | ||
6 | * License as published by the Free Software Foundation; either | ||
7 | * version 2.1 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This library is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * Lesser General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with this library; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | /*!\file sha1.h | ||
21 | * \brief SHA-1 hash function, headers. | ||
22 | * \author Bob Deblier <bob.deblier@pandora.be> | ||
23 | * \ingroup HASH_m HASH_sha1_m | ||
24 | */ | ||
25 | |||
26 | #ifndef _SHA1_H | ||
27 | #define _SHA1_H | ||
28 | |||
29 | #include "beecrypt/beecrypt.h" | ||
30 | #include "beecrypt/sha1opt.h" | ||
31 | |||
32 | /*!\brief Holds all the parameters necessary for the SHA-1 algorithm. | ||
33 | * \ingroup HASH_sha1_m | ||
34 | */ | ||
35 | #ifdef __cplusplus | ||
36 | struct BEECRYPTAPI sha1Param | ||
37 | #else | ||
38 | struct _sha1Param | ||
39 | #endif | ||
40 | { | ||
41 | /*!\var h | ||
42 | */ | ||
43 | uint32_t h[5]; | ||
44 | /*!\var data | ||
45 | */ | ||
46 | uint32_t data[80]; | ||
47 | /*!\var length | ||
48 | * \brief Multi-precision integer counter for the bits that have been | ||
49 | * processed so far. | ||
50 | */ | ||
51 | #if (MP_WBITS == 64) | ||
52 | mpw length[1]; | ||
53 | #elif (MP_WBITS == 32) | ||
54 | mpw length[2]; | ||
55 | #else | ||
56 | # error | ||
57 | #endif | ||
58 | /*!\var offset | ||
59 | * \brief Offset into \a data; points to the place where new data will be | ||
60 | * copied before it is processed. | ||
61 | */ | ||
62 | uint32_t offset; | ||
63 | }; | ||
64 | |||
65 | #ifndef __cplusplus | ||
66 | typedef struct _sha1Param sha1Param; | ||
67 | #endif | ||
68 | |||
69 | #ifdef __cplusplus | ||
70 | extern "C" { | ||
71 | #endif | ||
72 | |||
73 | /*!\var sha1 | ||
74 | * \brief Holds the full API description of the SHA-1 algorithm. | ||
75 | */ | ||
76 | extern BEECRYPTAPI const hashFunction sha1; | ||
77 | |||
78 | /*!\fn void sha1Process(sha1Param* sp) | ||
79 | * \brief This function performs the core of the SHA-1 hash algorithm; it | ||
80 | * processes a block of 64 bytes. | ||
81 | * \param sp The hash function's parameter block. | ||
82 | */ | ||
83 | BEECRYPTAPI | ||
84 | void sha1Process(sha1Param* sp); | ||
85 | |||
86 | /*!\fn int sha1Reset(sha1Param* sp) | ||
87 | * \brief This function resets the parameter block so that it's ready for a | ||
88 | * new hash. | ||
89 | * \param sp The hash function's parameter block. | ||
90 | * \retval 0 on success. | ||
91 | */ | ||
92 | BEECRYPTAPI | ||
93 | int sha1Reset (sha1Param* sp); | ||
94 | |||
95 | /*!\fn int sha1Update(sha1Param* sp, const byte* data, size_t size) | ||
96 | * \brief This function should be used to pass successive blocks of data | ||
97 | * to be hashed. | ||
98 | * \param sp The hash function's parameter block. | ||
99 | * \param data | ||
100 | * \param size | ||
101 | * \retval 0 on success. | ||
102 | */ | ||
103 | BEECRYPTAPI | ||
104 | int sha1Update (sha1Param* sp, const byte* data, size_t size); | ||
105 | |||
106 | /*!\fn int sha1Digest(sha1Param* sp, byte* digest) | ||
107 | * \brief This function finishes the current hash computation and copies | ||
108 | * the digest value into \a digest. | ||
109 | * \param sp The hash function's parameter block. | ||
110 | * \param digest The place to store the 20-byte digest. | ||
111 | * \retval 0 on success. | ||
112 | */ | ||
113 | BEECRYPTAPI | ||
114 | int sha1Digest (sha1Param* sp, byte* digest); | ||
115 | |||
116 | #ifdef __cplusplus | ||
117 | } | ||
118 | #endif | ||
119 | |||
120 | #endif | ||