mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
gh-99108: Refactor _sha256 & _sha512 into _sha2. (#101924)
This merges their code. They're backed by the same single HACL* static library, having them be a single module simplifies maintenance. This should unbreak the wasm enscripten builds that currently fail due to linking in --whole-archive mode and the HACL* library appearing twice. Long unnoticed error fixed: _sha512.SHA384Type was doubly assigned and was actually SHA512Type. Nobody depends on those internal names. Also rename LIBHACL_ make vars to LIBHACL_SHA2_ in preperation for other future HACL things.
This commit is contained in:
parent
89ac665891
commit
0b13575e74
18 changed files with 1310 additions and 1493 deletions
|
@ -92,13 +92,13 @@ def __get_builtin_constructor(name):
|
|||
import _md5
|
||||
cache['MD5'] = cache['md5'] = _md5.md5
|
||||
elif name in {'SHA256', 'sha256', 'SHA224', 'sha224'}:
|
||||
import _sha256
|
||||
cache['SHA224'] = cache['sha224'] = _sha256.sha224
|
||||
cache['SHA256'] = cache['sha256'] = _sha256.sha256
|
||||
import _sha2
|
||||
cache['SHA224'] = cache['sha224'] = _sha2.sha224
|
||||
cache['SHA256'] = cache['sha256'] = _sha2.sha256
|
||||
elif name in {'SHA512', 'sha512', 'SHA384', 'sha384'}:
|
||||
import _sha512
|
||||
cache['SHA384'] = cache['sha384'] = _sha512.sha384
|
||||
cache['SHA512'] = cache['sha512'] = _sha512.sha512
|
||||
import _sha2
|
||||
cache['SHA384'] = cache['sha384'] = _sha2.sha384
|
||||
cache['SHA512'] = cache['sha512'] = _sha2.sha512
|
||||
elif name in {'blake2b', 'blake2s'}:
|
||||
import _blake2
|
||||
cache['blake2b'] = _blake2.blake2b
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue