mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-18 06:34:19 +01:00
Fixes change endianness
Porting change_endianness from Python2 to Python3 introduced a bug.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Porting some functionality from https://github.com/sr-gi/bitcoin_tools with some modifications <3
|
||||
from hashlib import sha256
|
||||
from binascii import unhexlify
|
||||
from binascii import unhexlify, hexlify
|
||||
|
||||
|
||||
def change_endianness(x):
|
||||
@@ -15,9 +15,9 @@ def change_endianness(x):
|
||||
if (len(x) % 2) == 1:
|
||||
x += "0"
|
||||
|
||||
y = bytes(x, 'utf-8')
|
||||
y = unhexlify(x)
|
||||
z = y[::-1]
|
||||
return z.decode('utf-8')
|
||||
return hexlify(z).decode('utf-8')
|
||||
|
||||
|
||||
def parse_varint(tx):
|
||||
|
||||
Reference in New Issue
Block a user