[PYTHON-CRYPTO] Draft hashing PEP
Andrew Archibald
aarchiba at YAHOO.COM
Sat Mar 24 04:36:41 CET 2001
On Fri, Mar 23, 2001 at 05:50:31PM -0500, Andrew Kuchling wrote:
> Here's an informational PEP describing the API for hashing that I
> posted to the list last month. This draft includes the suggested
> revisions of dropping the hexdigest() method and adding clear(),
> adding an optional key argument to the constructor for a hash object.
>
> Comments requested; if there are none, then its status can be changed
> to 'Accepted'. (No PEP number allocated yet, but I've sent it off to
> Barry to get one.)
>
> --amk
I like it, in general, but I have a few comments:
Currently, sha objects have a digestsize attribute. This is convenient;
should it be required by the PEP?
How common are variable-size hashes? (For example, the SHA-160, SHA-256,
SHA-384, SHA-512 family) Is it worth allowing a module to support multiple
digest sizes? I would suggest allowing this by having such a module (say
SHA_variable) export a digestsize of 0. Then new() can accept a digestsize
argument, and each object will have its own digestsize attribute.
Some hashes have additional parameters (HAVAL has a rounds parameter, I
believe); perhaps new should accept arbitrary additional keyword arguments?
What should unkeyed hashes do when presented with a key? Presumably, raise
an exception.
Thanks,
Andrew
More information about the python-crypto
mailing list