Skip to content

Commit f1f2722

Browse files
committed
fix py3.2 compatibility
unhexlify("ff") doesn't work in py3.2: strings don't support the buffer interface. It works in py3.3.
1 parent 12f68c4 commit f1f2722

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ecdsa/test_pyecdsa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def test_1(self):
568568
self._do(
569569
generator = Point(None, 0, 0, int("4000000000000000000020108A2E0CC0D99F8A5EF", 16)),
570570
secexp = int("09A4D6792295A7F730FC3F2B49CBC0F62E862272F", 16),
571-
hsh = unhexlify("AF2BDBE1AA9B6EC1E2ADE1D694F41FC71A831D0268E9891562113D8A62ADD1BF"),
571+
hsh = unhexlify(b("AF2BDBE1AA9B6EC1E2ADE1D694F41FC71A831D0268E9891562113D8A62ADD1BF")),
572572
hash_func = sha256,
573573
expected = int("23AF4074C90A02B3FE61D286D5C87F425E6BDD81B", 16))
574574

ecdsa/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def number_to_string(num, order):
168168
def number_to_string_crop(num, order):
169169
l = orderlen(order)
170170
fmt_str = "%0" + str(2*l) + "x"
171-
string = binascii.unhexlify(fmt_str % num)
171+
string = binascii.unhexlify((fmt_str % num).encode())
172172
return string[:l]
173173

174174
def string_to_number(string):

0 commit comments

Comments
 (0)