base256.py: better support for hex value

This commit is contained in:
Von Random 2021-01-21 13:25:56 +03:00
parent 9cda0e04d8
commit d250409d5f

View file

@ -4,8 +4,7 @@
from sys import argv from sys import argv
def from_base256(number): def from_base256(number):
base = 16 if number.startswith('0x') else 10 num = int(number, 0)
num = int(number, base)
addr = list() addr = list()
for e in range(3, -1, -1): for e in range(3, -1, -1):
multiplier = 256 ** e multiplier = 256 ** e