[Python-Dev] SHA-256 module

A.M. Kuchling amk at amk.ca
Tue Jun 29 10:24:17 EDT 2004


Patch #935454 is a module implementing SHA-256, a variant of the
160-bit SHA algorithm supported in Python's existing sha module.
Though it's more recent than the original SHA-160, SHA-256 is just as
"standard"; both algorithms are specified by a NIST document.

The submitter comments:

	The difference is that it produces a 256 bit hash value,
	instead of a 160 bit hash value. SHA-256 thus has 128 bits of
	resistance against birthday attacks, which makes it secure in
	certain protocols where SHA-1 is questionable (e.g.  digital
	signatures; or RNGs or Key-Derivation Functions where you want
	to produce keys for 256-bit ciphers).

A quick skim over the code doesn't turn up any issues, and the patch
includes a test suite but no documentation.  I don't want to do a
detailed code review or require docs from the submitter if the module
isn't likely to be included, so do we want to add this module?

There are a bunch of other variants with different bit sizes such as
512, 384, and 224 bits.  The only one likely to matter is SHA-512, so
adding sha256 might mean that down the road we need to add a sha512
module, too, but that seems unlikely.

--amk




More information about the Python-Dev mailing list