[PYTHON-CRYPTO] amkCrypto: why 2-byte conversion for str2hex()?

Jason R. Mastaler jason-list-python-crypto at MASTALER.COM
Wed Mar 28 20:42:34 CEST 2001


"Jason R. Mastaler" <jason-list-python-crypto at MASTALER.COM> writes:

> Why does Crypto.Utils.str2hex() convert each byte of its string to a
> 2-byte HEX representation (as opposed to a 1-byte HEX representation).
>
> I ask because this might account for the difference in output I'm
> seeing between two functionally equivalent pieces of code (one in
> Perl, the other in Python).

Ignore this, I figured out the difference.  The perl code was packing
the plaintext into a binary structure before encrypting, and the
python code wasn't.  I was able to accomplish something similar using
python's ``struct'' module.





More information about the python-crypto mailing list