[pycrypto] Crypto.PublicKey.RSA and number.py

Anthony Honstain honstain at gmail.com
Wed Mar 11 23:47:03 CST 2009


I am working towards using the Crypto.PublicKey.RSA encryption and
eventually padding like PKCS#1. I have observed that the leading
'\000' are removed. Is this the desired behavior of bytes_to_long and
long_to_bytes? Or is this not an issue once a good padding scheme is
implemented?

For example: from lib/Crypto/Util/number.py module, using
bytes_to_long and long_to_bytes.
>>> teststring
'\x00\x00test\x00\x00'
>>> result = bytes_to_long(teststring)
>>> result
127979077500928L
>>> long_to_bytes(result)
'test\x00\x00'

Thanks,
Anthony Honstain


More information about the pycrypto mailing list