Lines Matching refs:sha_info
117 sha_transform(SHAobject *sha_info) in sha_transform() argument
122 memcpy(W, sha_info->data, sizeof(sha_info->data)); in sha_transform()
124 longReverse(W, (int)sizeof(sha_info->data)); in sha_transform()
131 S[i] = sha_info->digest[i]; in sha_transform()
210 sha_info->digest[i] = sha_info->digest[i] + S[i]; in sha_transform()
220 sha_init(SHAobject *sha_info) in sha_init() argument
222 sha_info->digest[0] = 0x6A09E667L; in sha_init()
223 sha_info->digest[1] = 0xBB67AE85L; in sha_init()
224 sha_info->digest[2] = 0x3C6EF372L; in sha_init()
225 sha_info->digest[3] = 0xA54FF53AL; in sha_init()
226 sha_info->digest[4] = 0x510E527FL; in sha_init()
227 sha_info->digest[5] = 0x9B05688CL; in sha_init()
228 sha_info->digest[6] = 0x1F83D9ABL; in sha_init()
229 sha_info->digest[7] = 0x5BE0CD19L; in sha_init()
230 sha_info->count_lo = 0L; in sha_init()
231 sha_info->count_hi = 0L; in sha_init()
232 sha_info->local = 0; in sha_init()
233 sha_info->digestsize = 32; in sha_init()
237 sha224_init(SHAobject *sha_info) in sha224_init() argument
239 sha_info->digest[0] = 0xc1059ed8L; in sha224_init()
240 sha_info->digest[1] = 0x367cd507L; in sha224_init()
241 sha_info->digest[2] = 0x3070dd17L; in sha224_init()
242 sha_info->digest[3] = 0xf70e5939L; in sha224_init()
243 sha_info->digest[4] = 0xffc00b31L; in sha224_init()
244 sha_info->digest[5] = 0x68581511L; in sha224_init()
245 sha_info->digest[6] = 0x64f98fa7L; in sha224_init()
246 sha_info->digest[7] = 0xbefa4fa4L; in sha224_init()
247 sha_info->count_lo = 0L; in sha224_init()
248 sha_info->count_hi = 0L; in sha224_init()
249 sha_info->local = 0; in sha224_init()
250 sha_info->digestsize = 28; in sha224_init()
257 sha_update(SHAobject *sha_info, SHA_BYTE *buffer, Py_ssize_t count) in sha_update() argument
262 clo = sha_info->count_lo + ((SHA_INT32) count << 3); in sha_update()
263 if (clo < sha_info->count_lo) { in sha_update()
264 ++sha_info->count_hi; in sha_update()
266 sha_info->count_lo = clo; in sha_update()
267 sha_info->count_hi += (SHA_INT32) count >> 29; in sha_update()
268 if (sha_info->local) { in sha_update()
269 i = SHA_BLOCKSIZE - sha_info->local; in sha_update()
273 memcpy(((SHA_BYTE *) sha_info->data) + sha_info->local, buffer, i); in sha_update()
276 sha_info->local += (int)i; in sha_update()
277 if (sha_info->local == SHA_BLOCKSIZE) { in sha_update()
278 sha_transform(sha_info); in sha_update()
285 memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); in sha_update()
288 sha_transform(sha_info); in sha_update()
290 memcpy(sha_info->data, buffer, count); in sha_update()
291 sha_info->local = (int)count; in sha_update()
297 sha_final(unsigned char digest[SHA_DIGESTSIZE], SHAobject *sha_info) in sha_final() argument
302 lo_bit_count = sha_info->count_lo; in sha_final()
303 hi_bit_count = sha_info->count_hi; in sha_final()
305 ((SHA_BYTE *) sha_info->data)[count++] = 0x80; in sha_final()
307 memset(((SHA_BYTE *) sha_info->data) + count, 0, in sha_final()
309 sha_transform(sha_info); in sha_final()
310 memset((SHA_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8); in sha_final()
313 memset(((SHA_BYTE *) sha_info->data) + count, 0, in sha_final()
319 sha_info->data[56] = (hi_bit_count >> 24) & 0xff; in sha_final()
320 sha_info->data[57] = (hi_bit_count >> 16) & 0xff; in sha_final()
321 sha_info->data[58] = (hi_bit_count >> 8) & 0xff; in sha_final()
322 sha_info->data[59] = (hi_bit_count >> 0) & 0xff; in sha_final()
323 sha_info->data[60] = (lo_bit_count >> 24) & 0xff; in sha_final()
324 sha_info->data[61] = (lo_bit_count >> 16) & 0xff; in sha_final()
325 sha_info->data[62] = (lo_bit_count >> 8) & 0xff; in sha_final()
326 sha_info->data[63] = (lo_bit_count >> 0) & 0xff; in sha_final()
327 sha_transform(sha_info); in sha_final()
328 digest[ 0] = (unsigned char) ((sha_info->digest[0] >> 24) & 0xff); in sha_final()
329 digest[ 1] = (unsigned char) ((sha_info->digest[0] >> 16) & 0xff); in sha_final()
330 digest[ 2] = (unsigned char) ((sha_info->digest[0] >> 8) & 0xff); in sha_final()
331 digest[ 3] = (unsigned char) ((sha_info->digest[0] ) & 0xff); in sha_final()
332 digest[ 4] = (unsigned char) ((sha_info->digest[1] >> 24) & 0xff); in sha_final()
333 digest[ 5] = (unsigned char) ((sha_info->digest[1] >> 16) & 0xff); in sha_final()
334 digest[ 6] = (unsigned char) ((sha_info->digest[1] >> 8) & 0xff); in sha_final()
335 digest[ 7] = (unsigned char) ((sha_info->digest[1] ) & 0xff); in sha_final()
336 digest[ 8] = (unsigned char) ((sha_info->digest[2] >> 24) & 0xff); in sha_final()
337 digest[ 9] = (unsigned char) ((sha_info->digest[2] >> 16) & 0xff); in sha_final()
338 digest[10] = (unsigned char) ((sha_info->digest[2] >> 8) & 0xff); in sha_final()
339 digest[11] = (unsigned char) ((sha_info->digest[2] ) & 0xff); in sha_final()
340 digest[12] = (unsigned char) ((sha_info->digest[3] >> 24) & 0xff); in sha_final()
341 digest[13] = (unsigned char) ((sha_info->digest[3] >> 16) & 0xff); in sha_final()
342 digest[14] = (unsigned char) ((sha_info->digest[3] >> 8) & 0xff); in sha_final()
343 digest[15] = (unsigned char) ((sha_info->digest[3] ) & 0xff); in sha_final()
344 digest[16] = (unsigned char) ((sha_info->digest[4] >> 24) & 0xff); in sha_final()
345 digest[17] = (unsigned char) ((sha_info->digest[4] >> 16) & 0xff); in sha_final()
346 digest[18] = (unsigned char) ((sha_info->digest[4] >> 8) & 0xff); in sha_final()
347 digest[19] = (unsigned char) ((sha_info->digest[4] ) & 0xff); in sha_final()
348 digest[20] = (unsigned char) ((sha_info->digest[5] >> 24) & 0xff); in sha_final()
349 digest[21] = (unsigned char) ((sha_info->digest[5] >> 16) & 0xff); in sha_final()
350 digest[22] = (unsigned char) ((sha_info->digest[5] >> 8) & 0xff); in sha_final()
351 digest[23] = (unsigned char) ((sha_info->digest[5] ) & 0xff); in sha_final()
352 digest[24] = (unsigned char) ((sha_info->digest[6] >> 24) & 0xff); in sha_final()
353 digest[25] = (unsigned char) ((sha_info->digest[6] >> 16) & 0xff); in sha_final()
354 digest[26] = (unsigned char) ((sha_info->digest[6] >> 8) & 0xff); in sha_final()
355 digest[27] = (unsigned char) ((sha_info->digest[6] ) & 0xff); in sha_final()
356 digest[28] = (unsigned char) ((sha_info->digest[7] >> 24) & 0xff); in sha_final()
357 digest[29] = (unsigned char) ((sha_info->digest[7] >> 16) & 0xff); in sha_final()
358 digest[30] = (unsigned char) ((sha_info->digest[7] >> 8) & 0xff); in sha_final()
359 digest[31] = (unsigned char) ((sha_info->digest[7] ) & 0xff); in sha_final()