diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-05-28 23:16:42 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-05-28 22:16:42 -0500 |
commit | 0bff7c259b915607757f21e2e6b94160f0b9401e (patch) | |
tree | c3b571f4649633e5494c50b8f1496d7e689025de /src | |
parent | e4318ea34e34241e7bcda489325ba1a51054ada5 (diff) | |
download | cryptography-0bff7c259b915607757f21e2e6b94160f0b9401e.tar.gz cryptography-0bff7c259b915607757f21e2e6b94160f0b9401e.tar.bz2 cryptography-0bff7c259b915607757f21e2e6b94160f0b9401e.zip |
Simplify int to hex string conversion (#3628)
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/backend.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py index 9900d053..412432df 100644 --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -331,9 +331,9 @@ class Backend(object): return bn_ptr else: - # Under Python 2 the best we can do is hex() - - hex_num = hex(num).rstrip("L").lstrip("0x").encode("ascii") or b"0" + # Under Python 2 the best we can do is hex(), [2:] removes the 0x + # prefix. + hex_num = hex(num).rstrip("L")[2:].encode("ascii") bn_ptr = self._ffi.new("BIGNUM **") bn_ptr[0] = bn res = self._lib.BN_hex2bn(bn_ptr, hex_num) |