vbuterin / pybitcointools

SImple, common-sense Bitcoin-themed Python ECC library
1.28k stars 856 forks source link

ecdsa_verify_addr fails on python3 #152

Open awemany opened 7 years ago

awemany commented 7 years ago

Works on python2:

bitcoin.ecdsa_verify_addr("a", "HAxTs/0PxPTCUVs7i0vWkaNtVAngQgHfJygNu9tfPna1Z5piImtwpr1XfTu7znc0g2m8uTDHcLu0JJFrwq5OqLM=", "1R7xTYaXV4pwsjnd8wjnx4LPoS2JAbQFm") returns False

But on python3, I get:

TypeError: ord() expected string of length 1, but int found

hmisty commented 4 years ago

You can fix it by yourself like this:

.../lib/python3.7/site-packages/bitcoin/main.py:435

435 return ord(data[0])

change to:

435 if type(data[0]) is int: 436 return data[0] 437 else: 438 return ord(data[0])