Lines Matching refs:sha_info
118 sha512_transform(SHAobject *sha_info) in sha512_transform() argument
123 memcpy(W, sha_info->data, sizeof(sha_info->data)); in sha512_transform()
125 longReverse(W, (int)sizeof(sha_info->data)); in sha512_transform()
132 S[i] = sha_info->digest[i]; in sha512_transform()
227 sha_info->digest[i] = sha_info->digest[i] + S[i]; in sha512_transform()
237 sha512_init(SHAobject *sha_info) in sha512_init() argument
239 sha_info->digest[0] = Py_ULL(0x6a09e667f3bcc908); in sha512_init()
240 sha_info->digest[1] = Py_ULL(0xbb67ae8584caa73b); in sha512_init()
241 sha_info->digest[2] = Py_ULL(0x3c6ef372fe94f82b); in sha512_init()
242 sha_info->digest[3] = Py_ULL(0xa54ff53a5f1d36f1); in sha512_init()
243 sha_info->digest[4] = Py_ULL(0x510e527fade682d1); in sha512_init()
244 sha_info->digest[5] = Py_ULL(0x9b05688c2b3e6c1f); in sha512_init()
245 sha_info->digest[6] = Py_ULL(0x1f83d9abfb41bd6b); in sha512_init()
246 sha_info->digest[7] = Py_ULL(0x5be0cd19137e2179); in sha512_init()
247 sha_info->count_lo = 0L; in sha512_init()
248 sha_info->count_hi = 0L; in sha512_init()
249 sha_info->local = 0; in sha512_init()
250 sha_info->digestsize = 64; in sha512_init()
254 sha384_init(SHAobject *sha_info) in sha384_init() argument
256 sha_info->digest[0] = Py_ULL(0xcbbb9d5dc1059ed8); in sha384_init()
257 sha_info->digest[1] = Py_ULL(0x629a292a367cd507); in sha384_init()
258 sha_info->digest[2] = Py_ULL(0x9159015a3070dd17); in sha384_init()
259 sha_info->digest[3] = Py_ULL(0x152fecd8f70e5939); in sha384_init()
260 sha_info->digest[4] = Py_ULL(0x67332667ffc00b31); in sha384_init()
261 sha_info->digest[5] = Py_ULL(0x8eb44a8768581511); in sha384_init()
262 sha_info->digest[6] = Py_ULL(0xdb0c2e0d64f98fa7); in sha384_init()
263 sha_info->digest[7] = Py_ULL(0x47b5481dbefa4fa4); in sha384_init()
264 sha_info->count_lo = 0L; in sha384_init()
265 sha_info->count_hi = 0L; in sha384_init()
266 sha_info->local = 0; in sha384_init()
267 sha_info->digestsize = 48; in sha384_init()
274 sha512_update(SHAobject *sha_info, SHA_BYTE *buffer, Py_ssize_t count) in sha512_update() argument
279 clo = sha_info->count_lo + ((SHA_INT32) count << 3); in sha512_update()
280 if (clo < sha_info->count_lo) { in sha512_update()
281 ++sha_info->count_hi; in sha512_update()
283 sha_info->count_lo = clo; in sha512_update()
284 sha_info->count_hi += (SHA_INT32) count >> 29; in sha512_update()
285 if (sha_info->local) { in sha512_update()
286 i = SHA_BLOCKSIZE - sha_info->local; in sha512_update()
290 memcpy(((SHA_BYTE *) sha_info->data) + sha_info->local, buffer, i); in sha512_update()
293 sha_info->local += (int)i; in sha512_update()
294 if (sha_info->local == SHA_BLOCKSIZE) { in sha512_update()
295 sha512_transform(sha_info); in sha512_update()
302 memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); in sha512_update()
305 sha512_transform(sha_info); in sha512_update()
307 memcpy(sha_info->data, buffer, count); in sha512_update()
308 sha_info->local = (int)count; in sha512_update()
314 sha512_final(unsigned char digest[SHA_DIGESTSIZE], SHAobject *sha_info) in sha512_final() argument
319 lo_bit_count = sha_info->count_lo; in sha512_final()
320 hi_bit_count = sha_info->count_hi; in sha512_final()
322 ((SHA_BYTE *) sha_info->data)[count++] = 0x80; in sha512_final()
324 memset(((SHA_BYTE *) sha_info->data) + count, 0, in sha512_final()
326 sha512_transform(sha_info); in sha512_final()
327 memset((SHA_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 16); in sha512_final()
330 memset(((SHA_BYTE *) sha_info->data) + count, 0, in sha512_final()
336 sha_info->data[112] = 0; in sha512_final()
337 sha_info->data[113] = 0; in sha512_final()
338 sha_info->data[114] = 0; in sha512_final()
339 sha_info->data[115] = 0; in sha512_final()
340 sha_info->data[116] = 0; in sha512_final()
341 sha_info->data[117] = 0; in sha512_final()
342 sha_info->data[118] = 0; in sha512_final()
343 sha_info->data[119] = 0; in sha512_final()
344 sha_info->data[120] = (hi_bit_count >> 24) & 0xff; in sha512_final()
345 sha_info->data[121] = (hi_bit_count >> 16) & 0xff; in sha512_final()
346 sha_info->data[122] = (hi_bit_count >> 8) & 0xff; in sha512_final()
347 sha_info->data[123] = (hi_bit_count >> 0) & 0xff; in sha512_final()
348 sha_info->data[124] = (lo_bit_count >> 24) & 0xff; in sha512_final()
349 sha_info->data[125] = (lo_bit_count >> 16) & 0xff; in sha512_final()
350 sha_info->data[126] = (lo_bit_count >> 8) & 0xff; in sha512_final()
351 sha_info->data[127] = (lo_bit_count >> 0) & 0xff; in sha512_final()
352 sha512_transform(sha_info); in sha512_final()
353 digest[ 0] = (unsigned char) ((sha_info->digest[0] >> 56) & 0xff); in sha512_final()
354 digest[ 1] = (unsigned char) ((sha_info->digest[0] >> 48) & 0xff); in sha512_final()
355 digest[ 2] = (unsigned char) ((sha_info->digest[0] >> 40) & 0xff); in sha512_final()
356 digest[ 3] = (unsigned char) ((sha_info->digest[0] >> 32) & 0xff); in sha512_final()
357 digest[ 4] = (unsigned char) ((sha_info->digest[0] >> 24) & 0xff); in sha512_final()
358 digest[ 5] = (unsigned char) ((sha_info->digest[0] >> 16) & 0xff); in sha512_final()
359 digest[ 6] = (unsigned char) ((sha_info->digest[0] >> 8) & 0xff); in sha512_final()
360 digest[ 7] = (unsigned char) ((sha_info->digest[0] ) & 0xff); in sha512_final()
361 digest[ 8] = (unsigned char) ((sha_info->digest[1] >> 56) & 0xff); in sha512_final()
362 digest[ 9] = (unsigned char) ((sha_info->digest[1] >> 48) & 0xff); in sha512_final()
363 digest[10] = (unsigned char) ((sha_info->digest[1] >> 40) & 0xff); in sha512_final()
364 digest[11] = (unsigned char) ((sha_info->digest[1] >> 32) & 0xff); in sha512_final()
365 digest[12] = (unsigned char) ((sha_info->digest[1] >> 24) & 0xff); in sha512_final()
366 digest[13] = (unsigned char) ((sha_info->digest[1] >> 16) & 0xff); in sha512_final()
367 digest[14] = (unsigned char) ((sha_info->digest[1] >> 8) & 0xff); in sha512_final()
368 digest[15] = (unsigned char) ((sha_info->digest[1] ) & 0xff); in sha512_final()
369 digest[16] = (unsigned char) ((sha_info->digest[2] >> 56) & 0xff); in sha512_final()
370 digest[17] = (unsigned char) ((sha_info->digest[2] >> 48) & 0xff); in sha512_final()
371 digest[18] = (unsigned char) ((sha_info->digest[2] >> 40) & 0xff); in sha512_final()
372 digest[19] = (unsigned char) ((sha_info->digest[2] >> 32) & 0xff); in sha512_final()
373 digest[20] = (unsigned char) ((sha_info->digest[2] >> 24) & 0xff); in sha512_final()
374 digest[21] = (unsigned char) ((sha_info->digest[2] >> 16) & 0xff); in sha512_final()
375 digest[22] = (unsigned char) ((sha_info->digest[2] >> 8) & 0xff); in sha512_final()
376 digest[23] = (unsigned char) ((sha_info->digest[2] ) & 0xff); in sha512_final()
377 digest[24] = (unsigned char) ((sha_info->digest[3] >> 56) & 0xff); in sha512_final()
378 digest[25] = (unsigned char) ((sha_info->digest[3] >> 48) & 0xff); in sha512_final()
379 digest[26] = (unsigned char) ((sha_info->digest[3] >> 40) & 0xff); in sha512_final()
380 digest[27] = (unsigned char) ((sha_info->digest[3] >> 32) & 0xff); in sha512_final()
381 digest[28] = (unsigned char) ((sha_info->digest[3] >> 24) & 0xff); in sha512_final()
382 digest[29] = (unsigned char) ((sha_info->digest[3] >> 16) & 0xff); in sha512_final()
383 digest[30] = (unsigned char) ((sha_info->digest[3] >> 8) & 0xff); in sha512_final()
384 digest[31] = (unsigned char) ((sha_info->digest[3] ) & 0xff); in sha512_final()
385 digest[32] = (unsigned char) ((sha_info->digest[4] >> 56) & 0xff); in sha512_final()
386 digest[33] = (unsigned char) ((sha_info->digest[4] >> 48) & 0xff); in sha512_final()
387 digest[34] = (unsigned char) ((sha_info->digest[4] >> 40) & 0xff); in sha512_final()
388 digest[35] = (unsigned char) ((sha_info->digest[4] >> 32) & 0xff); in sha512_final()
389 digest[36] = (unsigned char) ((sha_info->digest[4] >> 24) & 0xff); in sha512_final()
390 digest[37] = (unsigned char) ((sha_info->digest[4] >> 16) & 0xff); in sha512_final()
391 digest[38] = (unsigned char) ((sha_info->digest[4] >> 8) & 0xff); in sha512_final()
392 digest[39] = (unsigned char) ((sha_info->digest[4] ) & 0xff); in sha512_final()
393 digest[40] = (unsigned char) ((sha_info->digest[5] >> 56) & 0xff); in sha512_final()
394 digest[41] = (unsigned char) ((sha_info->digest[5] >> 48) & 0xff); in sha512_final()
395 digest[42] = (unsigned char) ((sha_info->digest[5] >> 40) & 0xff); in sha512_final()
396 digest[43] = (unsigned char) ((sha_info->digest[5] >> 32) & 0xff); in sha512_final()
397 digest[44] = (unsigned char) ((sha_info->digest[5] >> 24) & 0xff); in sha512_final()
398 digest[45] = (unsigned char) ((sha_info->digest[5] >> 16) & 0xff); in sha512_final()
399 digest[46] = (unsigned char) ((sha_info->digest[5] >> 8) & 0xff); in sha512_final()
400 digest[47] = (unsigned char) ((sha_info->digest[5] ) & 0xff); in sha512_final()
401 digest[48] = (unsigned char) ((sha_info->digest[6] >> 56) & 0xff); in sha512_final()
402 digest[49] = (unsigned char) ((sha_info->digest[6] >> 48) & 0xff); in sha512_final()
403 digest[50] = (unsigned char) ((sha_info->digest[6] >> 40) & 0xff); in sha512_final()
404 digest[51] = (unsigned char) ((sha_info->digest[6] >> 32) & 0xff); in sha512_final()
405 digest[52] = (unsigned char) ((sha_info->digest[6] >> 24) & 0xff); in sha512_final()
406 digest[53] = (unsigned char) ((sha_info->digest[6] >> 16) & 0xff); in sha512_final()
407 digest[54] = (unsigned char) ((sha_info->digest[6] >> 8) & 0xff); in sha512_final()
408 digest[55] = (unsigned char) ((sha_info->digest[6] ) & 0xff); in sha512_final()
409 digest[56] = (unsigned char) ((sha_info->digest[7] >> 56) & 0xff); in sha512_final()
410 digest[57] = (unsigned char) ((sha_info->digest[7] >> 48) & 0xff); in sha512_final()
411 digest[58] = (unsigned char) ((sha_info->digest[7] >> 40) & 0xff); in sha512_final()
412 digest[59] = (unsigned char) ((sha_info->digest[7] >> 32) & 0xff); in sha512_final()
413 digest[60] = (unsigned char) ((sha_info->digest[7] >> 24) & 0xff); in sha512_final()
414 digest[61] = (unsigned char) ((sha_info->digest[7] >> 16) & 0xff); in sha512_final()
415 digest[62] = (unsigned char) ((sha_info->digest[7] >> 8) & 0xff); in sha512_final()
416 digest[63] = (unsigned char) ((sha_info->digest[7] ) & 0xff); in sha512_final()