2021-02-09 23:26:48 +01:00
|
|
|
# third-party imports
|
|
|
|
from hexathon import strip_0x
|
2021-02-03 23:03:39 +01:00
|
|
|
|
|
|
|
|
2021-02-03 20:55:39 +01:00
|
|
|
def hex_to_int(hx, endianness='big'):
|
|
|
|
hx = strip_0x(hx)
|
2021-02-09 23:26:48 +01:00
|
|
|
if len(hx) % 2 == 1:
|
|
|
|
hx = '0' + hx
|
2021-02-03 20:55:39 +01:00
|
|
|
b = bytes.fromhex(hx)
|
|
|
|
return int.from_bytes(b, endianness)
|