Lines Matching refs:sha_info
135 sha512_transform(SHAobject *sha_info) in sha512_transform() argument
140 memcpy(W, sha_info->data, sizeof(sha_info->data)); in sha512_transform()
142 longReverse(W, (int)sizeof(sha_info->data)); in sha512_transform()
149 S[i] = sha_info->digest[i]; in sha512_transform()
244 sha_info->digest[i] = sha_info->digest[i] + S[i]; in sha512_transform()
254 sha512_init(SHAobject *sha_info) in sha512_init() argument
256 sha_info->digest[0] = Py_ULL(0x6a09e667f3bcc908); in sha512_init()
257 sha_info->digest[1] = Py_ULL(0xbb67ae8584caa73b); in sha512_init()
258 sha_info->digest[2] = Py_ULL(0x3c6ef372fe94f82b); in sha512_init()
259 sha_info->digest[3] = Py_ULL(0xa54ff53a5f1d36f1); in sha512_init()
260 sha_info->digest[4] = Py_ULL(0x510e527fade682d1); in sha512_init()
261 sha_info->digest[5] = Py_ULL(0x9b05688c2b3e6c1f); in sha512_init()
262 sha_info->digest[6] = Py_ULL(0x1f83d9abfb41bd6b); in sha512_init()
263 sha_info->digest[7] = Py_ULL(0x5be0cd19137e2179); in sha512_init()
264 sha_info->count_lo = 0L; in sha512_init()
265 sha_info->count_hi = 0L; in sha512_init()
266 sha_info->local = 0; in sha512_init()
267 sha_info->digestsize = 64; in sha512_init()
271 sha384_init(SHAobject *sha_info) in sha384_init() argument
273 sha_info->digest[0] = Py_ULL(0xcbbb9d5dc1059ed8); in sha384_init()
274 sha_info->digest[1] = Py_ULL(0x629a292a367cd507); in sha384_init()
275 sha_info->digest[2] = Py_ULL(0x9159015a3070dd17); in sha384_init()
276 sha_info->digest[3] = Py_ULL(0x152fecd8f70e5939); in sha384_init()
277 sha_info->digest[4] = Py_ULL(0x67332667ffc00b31); in sha384_init()
278 sha_info->digest[5] = Py_ULL(0x8eb44a8768581511); in sha384_init()
279 sha_info->digest[6] = Py_ULL(0xdb0c2e0d64f98fa7); in sha384_init()
280 sha_info->digest[7] = Py_ULL(0x47b5481dbefa4fa4); in sha384_init()
281 sha_info->count_lo = 0L; in sha384_init()
282 sha_info->count_hi = 0L; in sha384_init()
283 sha_info->local = 0; in sha384_init()
284 sha_info->digestsize = 48; in sha384_init()
291 sha512_update(SHAobject *sha_info, SHA_BYTE *buffer, Py_ssize_t count) in sha512_update() argument
296 clo = sha_info->count_lo + ((SHA_INT32) count << 3); in sha512_update()
297 if (clo < sha_info->count_lo) { in sha512_update()
298 ++sha_info->count_hi; in sha512_update()
300 sha_info->count_lo = clo; in sha512_update()
301 sha_info->count_hi += (SHA_INT32) count >> 29; in sha512_update()
302 if (sha_info->local) { in sha512_update()
303 i = SHA_BLOCKSIZE - sha_info->local; in sha512_update()
307 memcpy(((SHA_BYTE *) sha_info->data) + sha_info->local, buffer, i); in sha512_update()
310 sha_info->local += (int)i; in sha512_update()
311 if (sha_info->local == SHA_BLOCKSIZE) { in sha512_update()
312 sha512_transform(sha_info); in sha512_update()
319 memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); in sha512_update()
322 sha512_transform(sha_info); in sha512_update()
324 memcpy(sha_info->data, buffer, count); in sha512_update()
325 sha_info->local = (int)count; in sha512_update()
331 sha512_final(unsigned char digest[SHA_DIGESTSIZE], SHAobject *sha_info) in sha512_final() argument
336 lo_bit_count = sha_info->count_lo; in sha512_final()
337 hi_bit_count = sha_info->count_hi; in sha512_final()
339 ((SHA_BYTE *) sha_info->data)[count++] = 0x80; in sha512_final()
341 memset(((SHA_BYTE *) sha_info->data) + count, 0, in sha512_final()
343 sha512_transform(sha_info); in sha512_final()
344 memset((SHA_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 16); in sha512_final()
347 memset(((SHA_BYTE *) sha_info->data) + count, 0, in sha512_final()
353 sha_info->data[112] = 0; in sha512_final()
354 sha_info->data[113] = 0; in sha512_final()
355 sha_info->data[114] = 0; in sha512_final()
356 sha_info->data[115] = 0; in sha512_final()
357 sha_info->data[116] = 0; in sha512_final()
358 sha_info->data[117] = 0; in sha512_final()
359 sha_info->data[118] = 0; in sha512_final()
360 sha_info->data[119] = 0; in sha512_final()
361 sha_info->data[120] = (hi_bit_count >> 24) & 0xff; in sha512_final()
362 sha_info->data[121] = (hi_bit_count >> 16) & 0xff; in sha512_final()
363 sha_info->data[122] = (hi_bit_count >> 8) & 0xff; in sha512_final()
364 sha_info->data[123] = (hi_bit_count >> 0) & 0xff; in sha512_final()
365 sha_info->data[124] = (lo_bit_count >> 24) & 0xff; in sha512_final()
366 sha_info->data[125] = (lo_bit_count >> 16) & 0xff; in sha512_final()
367 sha_info->data[126] = (lo_bit_count >> 8) & 0xff; in sha512_final()
368 sha_info->data[127] = (lo_bit_count >> 0) & 0xff; in sha512_final()
369 sha512_transform(sha_info); in sha512_final()
370 digest[ 0] = (unsigned char) ((sha_info->digest[0] >> 56) & 0xff); in sha512_final()
371 digest[ 1] = (unsigned char) ((sha_info->digest[0] >> 48) & 0xff); in sha512_final()
372 digest[ 2] = (unsigned char) ((sha_info->digest[0] >> 40) & 0xff); in sha512_final()
373 digest[ 3] = (unsigned char) ((sha_info->digest[0] >> 32) & 0xff); in sha512_final()
374 digest[ 4] = (unsigned char) ((sha_info->digest[0] >> 24) & 0xff); in sha512_final()
375 digest[ 5] = (unsigned char) ((sha_info->digest[0] >> 16) & 0xff); in sha512_final()
376 digest[ 6] = (unsigned char) ((sha_info->digest[0] >> 8) & 0xff); in sha512_final()
377 digest[ 7] = (unsigned char) ((sha_info->digest[0] ) & 0xff); in sha512_final()
378 digest[ 8] = (unsigned char) ((sha_info->digest[1] >> 56) & 0xff); in sha512_final()
379 digest[ 9] = (unsigned char) ((sha_info->digest[1] >> 48) & 0xff); in sha512_final()
380 digest[10] = (unsigned char) ((sha_info->digest[1] >> 40) & 0xff); in sha512_final()
381 digest[11] = (unsigned char) ((sha_info->digest[1] >> 32) & 0xff); in sha512_final()
382 digest[12] = (unsigned char) ((sha_info->digest[1] >> 24) & 0xff); in sha512_final()
383 digest[13] = (unsigned char) ((sha_info->digest[1] >> 16) & 0xff); in sha512_final()
384 digest[14] = (unsigned char) ((sha_info->digest[1] >> 8) & 0xff); in sha512_final()
385 digest[15] = (unsigned char) ((sha_info->digest[1] ) & 0xff); in sha512_final()
386 digest[16] = (unsigned char) ((sha_info->digest[2] >> 56) & 0xff); in sha512_final()
387 digest[17] = (unsigned char) ((sha_info->digest[2] >> 48) & 0xff); in sha512_final()
388 digest[18] = (unsigned char) ((sha_info->digest[2] >> 40) & 0xff); in sha512_final()
389 digest[19] = (unsigned char) ((sha_info->digest[2] >> 32) & 0xff); in sha512_final()
390 digest[20] = (unsigned char) ((sha_info->digest[2] >> 24) & 0xff); in sha512_final()
391 digest[21] = (unsigned char) ((sha_info->digest[2] >> 16) & 0xff); in sha512_final()
392 digest[22] = (unsigned char) ((sha_info->digest[2] >> 8) & 0xff); in sha512_final()
393 digest[23] = (unsigned char) ((sha_info->digest[2] ) & 0xff); in sha512_final()
394 digest[24] = (unsigned char) ((sha_info->digest[3] >> 56) & 0xff); in sha512_final()
395 digest[25] = (unsigned char) ((sha_info->digest[3] >> 48) & 0xff); in sha512_final()
396 digest[26] = (unsigned char) ((sha_info->digest[3] >> 40) & 0xff); in sha512_final()
397 digest[27] = (unsigned char) ((sha_info->digest[3] >> 32) & 0xff); in sha512_final()
398 digest[28] = (unsigned char) ((sha_info->digest[3] >> 24) & 0xff); in sha512_final()
399 digest[29] = (unsigned char) ((sha_info->digest[3] >> 16) & 0xff); in sha512_final()
400 digest[30] = (unsigned char) ((sha_info->digest[3] >> 8) & 0xff); in sha512_final()
401 digest[31] = (unsigned char) ((sha_info->digest[3] ) & 0xff); in sha512_final()
402 digest[32] = (unsigned char) ((sha_info->digest[4] >> 56) & 0xff); in sha512_final()
403 digest[33] = (unsigned char) ((sha_info->digest[4] >> 48) & 0xff); in sha512_final()
404 digest[34] = (unsigned char) ((sha_info->digest[4] >> 40) & 0xff); in sha512_final()
405 digest[35] = (unsigned char) ((sha_info->digest[4] >> 32) & 0xff); in sha512_final()
406 digest[36] = (unsigned char) ((sha_info->digest[4] >> 24) & 0xff); in sha512_final()
407 digest[37] = (unsigned char) ((sha_info->digest[4] >> 16) & 0xff); in sha512_final()
408 digest[38] = (unsigned char) ((sha_info->digest[4] >> 8) & 0xff); in sha512_final()
409 digest[39] = (unsigned char) ((sha_info->digest[4] ) & 0xff); in sha512_final()
410 digest[40] = (unsigned char) ((sha_info->digest[5] >> 56) & 0xff); in sha512_final()
411 digest[41] = (unsigned char) ((sha_info->digest[5] >> 48) & 0xff); in sha512_final()
412 digest[42] = (unsigned char) ((sha_info->digest[5] >> 40) & 0xff); in sha512_final()
413 digest[43] = (unsigned char) ((sha_info->digest[5] >> 32) & 0xff); in sha512_final()
414 digest[44] = (unsigned char) ((sha_info->digest[5] >> 24) & 0xff); in sha512_final()
415 digest[45] = (unsigned char) ((sha_info->digest[5] >> 16) & 0xff); in sha512_final()
416 digest[46] = (unsigned char) ((sha_info->digest[5] >> 8) & 0xff); in sha512_final()
417 digest[47] = (unsigned char) ((sha_info->digest[5] ) & 0xff); in sha512_final()
418 digest[48] = (unsigned char) ((sha_info->digest[6] >> 56) & 0xff); in sha512_final()
419 digest[49] = (unsigned char) ((sha_info->digest[6] >> 48) & 0xff); in sha512_final()
420 digest[50] = (unsigned char) ((sha_info->digest[6] >> 40) & 0xff); in sha512_final()
421 digest[51] = (unsigned char) ((sha_info->digest[6] >> 32) & 0xff); in sha512_final()
422 digest[52] = (unsigned char) ((sha_info->digest[6] >> 24) & 0xff); in sha512_final()
423 digest[53] = (unsigned char) ((sha_info->digest[6] >> 16) & 0xff); in sha512_final()
424 digest[54] = (unsigned char) ((sha_info->digest[6] >> 8) & 0xff); in sha512_final()
425 digest[55] = (unsigned char) ((sha_info->digest[6] ) & 0xff); in sha512_final()
426 digest[56] = (unsigned char) ((sha_info->digest[7] >> 56) & 0xff); in sha512_final()
427 digest[57] = (unsigned char) ((sha_info->digest[7] >> 48) & 0xff); in sha512_final()
428 digest[58] = (unsigned char) ((sha_info->digest[7] >> 40) & 0xff); in sha512_final()
429 digest[59] = (unsigned char) ((sha_info->digest[7] >> 32) & 0xff); in sha512_final()
430 digest[60] = (unsigned char) ((sha_info->digest[7] >> 24) & 0xff); in sha512_final()
431 digest[61] = (unsigned char) ((sha_info->digest[7] >> 16) & 0xff); in sha512_final()
432 digest[62] = (unsigned char) ((sha_info->digest[7] >> 8) & 0xff); in sha512_final()
433 digest[63] = (unsigned char) ((sha_info->digest[7] ) & 0xff); in sha512_final()