1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-21 00:19:42 +02:00

add colon seperators to hex strings in python 3.6 and 3.7

This commit is contained in:
Kelly Brazil
2022-07-05 19:19:06 -07:00
parent 855c9363a5
commit 991b612b62

View File

@ -240,7 +240,9 @@ def _b2a(byte_string: bytes) -> str:
try: try:
return binascii.hexlify(byte_string, ':').decode('utf-8') return binascii.hexlify(byte_string, ':').decode('utf-8')
except TypeError: except TypeError:
return binascii.hexlify(byte_string).decode('utf-8') hex_string = binascii.hexlify(byte_string).decode('utf-8')
colon_seperated = ':'.join(hex_string[i:i+2] for i in range(0, len(hex_string), 2))
return colon_seperated
def _fix_objects(obj): def _fix_objects(obj):