Better crypto hash functions, long, with code

Paul Rubin http
Fri Aug 26 11:27:26 CEST 2005

Bryan Olson <fakeaddress at> writes:
> The module provides classes and functions. The functions are:
>      string_to_hex(str): Return a string with two hex digits for
>      each byte of str, representing the ord() of the byte. The
>      case of the hex digits A-F/a-f is up to Python's built-in
>      formatting; Python doc doesn't specify the case, so it may
>      be either and may change.
>      oid_to_der(arc_sequence): Return the DER encoding of an OID,
>      including the encoded tag and length.
>      smd_from_oid(oid): Look up and return the Secure Message
>      Digest class corresponding to the oid, or None if no such
>      class is known. The oid may be a sequence of integer arcs,
>      or a string holding the DER encoding.

Note there's a PEP for crypto hash function API's and modules
like expect hashes to conform to it:

You might want to bring your own API closer to it.  Also, I think the
PEP should be extended to include those OID lookup functions.

More information about the Python-list mailing list