mirror of
https://github.com/FlipsideCrypto/fsc-utils.git
synced 2026-02-06 10:56:49 +00:00
revert
This commit is contained in:
parent
45533df1cd
commit
8ee6344216
@ -317,8 +317,29 @@ def transform_hex_to_tezos(input, prefix):
|
||||
|
||||
full_hash = prefixed_hash + checksum
|
||||
|
||||
tezos_address = fsc_utils.create_udf_hex_to_base58(full_hash.hex())
|
||||
tezos_address = transform_hex_to_base58(full_hash.hex())
|
||||
|
||||
return tezos_address
|
||||
|
||||
def transform_hex_to_base58(input):
|
||||
if input is None:
|
||||
return None
|
||||
|
||||
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
||||
byte_array = bytes.fromhex(input)
|
||||
num = int.from_bytes(byte_array, 'big')
|
||||
|
||||
encoded = ''
|
||||
while num > 0:
|
||||
num, remainder = divmod(num, 58)
|
||||
encoded = ALPHABET[remainder] + encoded
|
||||
|
||||
for byte in byte_array:
|
||||
if byte == 0:
|
||||
encoded = '1' + encoded
|
||||
else:
|
||||
break
|
||||
|
||||
return encoded
|
||||
|
||||
{% endmacro %}
|
||||
Loading…
Reference in New Issue
Block a user