Lines Matching +full:- +full:3

2 SHA-1 in C
3 By Steve Reid <sreid@sea-to-sky.net>
6 -----------------
23 greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update().
26 be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million
36 --
40 3. Changed exit(0) to return(0) at end of main.
43 -----------------
45 By Steve Reid <sreid@sea-to-sky.net>
48 1- Removed #include <process.h> and used return() instead of exit()
49 2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall)
50 3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net
52 -----------------
58 -----------------
80 Test Vectors (from FIPS PUB 180-1)
100 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
118 block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00)
119 | (rol(block->l[i], 8) & 0x00FF00FF);
121 return block->l[i];
125 ((block)->l[(i)&15] = \
126 rol((block)->l[((i) + 13) & 15] ^ (block)->l[((i) + 8) & 15] \
127 ^ (block)->l[((i) + 2) & 15] ^ (block)->l[(i)&15], \
148 /* Hash a single 512-bit block. This is the core of the algorithm. */
158 /* Copy context->state[] to working vars */
162 d = state[3];
169 R0(c, d, e, a, b, 3);
251 state[3] += d;
256 /* SHA1Init - Initialize new context */
261 context->state[0] = 0x67452301;
262 context->state[1] = 0xEFCDAB89;
263 context->state[2] = 0x98BADCFE;
264 context->state[3] = 0x10325476;
265 context->state[4] = 0xC3D2E1F0;
266 context->count[0] = context->count[1] = 0;
275 j = context->count[0];
276 if ((context->count[0] += (len << 3)) < j) {
277 context->count[1]++;
279 context->count[1] += (len >> 29);
280 j = (j >> 3) & 63;
282 i = 64 - j;
283 memcpy(&context->buffer[j], data, i);
284 SHA1_Transform(context->state, context->buffer);
286 SHA1_Transform(context->state, &data[i]);
292 memcpy(&context->buffer[j], &data[i], len - i);
305 (uint8_t)((context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8))
309 while ((context->count[0] & 504) != 448) {
315 (uint8_t)((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) & 255);