mirror of
https://github.com/FlipsideCrypto/fsc-utils.git
synced 2026-02-06 10:56:49 +00:00
leading zeroes
This commit is contained in:
parent
f560e45de5
commit
a4ff4a46fb
@ -189,6 +189,14 @@ def transform_base58_to_hex(input):
|
||||
base_count = len(ALPHABET)
|
||||
|
||||
num = 0
|
||||
leading_zeros = 0
|
||||
|
||||
for char in input:
|
||||
if char == '1':
|
||||
leading_zeros += 1
|
||||
else:
|
||||
break
|
||||
|
||||
for char in input:
|
||||
num *= base_count
|
||||
if char in ALPHABET:
|
||||
@ -201,7 +209,9 @@ def transform_base58_to_hex(input):
|
||||
if len(hex_string) % 2 != 0:
|
||||
hex_string = '0' + hex_string
|
||||
|
||||
return '0x' + hex_string
|
||||
hex_leading_zeros = '00' * leading_zeros
|
||||
|
||||
return '0x' + hex_leading_zeros + hex_string
|
||||
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user