aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/utils.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-08-08 11:10:32 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-08-08 11:10:32 -0500
commita39e3d165bfc3e4dd94a80d8ff17af356113d918 (patch)
tree99d764554eeb9a6d013e7f096def69306fba278f /src/cryptography/utils.py
parentdbd47de45a7dd40ea1e2d1bc941ee07ddf6b1a59 (diff)
downloadcryptography-a39e3d165bfc3e4dd94a80d8ff17af356113d918.tar.gz
cryptography-a39e3d165bfc3e4dd94a80d8ff17af356113d918.tar.bz2
cryptography-a39e3d165bfc3e4dd94a80d8ff17af356113d918.zip
py3 int.to_bytes is dead to me
Diffstat (limited to 'src/cryptography/utils.py')
-rw-r--r--src/cryptography/utils.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
index 4ca4a7a2..993571bd 100644
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -47,16 +47,10 @@ else:
return result
-if hasattr(int, "to_bytes"):
- int_to_bytes = int.to_bytes
-else:
- def int_to_bytes(integer, byteorder, signed=False):
- assert byteorder == 'big'
- assert not signed
-
- hex_string = '%x' % integer
- n = len(hex_string)
- return binascii.unhexlify(hex_string.zfill(n + (n & 1)))
+def int_to_bytes(integer):
+ hex_string = '%x' % integer
+ n = len(hex_string)
+ return binascii.unhexlify(hex_string.zfill(n + (n & 1)))
class InterfaceNotImplemented(Exception):