Python conversion hex to string, high and low data processing

Python converts HEX to String, String to HEX high-low data processing

def Hex_Str16(data):
    hex_str = '{:04X}'.format(data*100)
    data_h, data_l = hex_str[0:2], hex_str[2:4]
    return  int(data_h, base=16), int(data_l, base=16)

def Hex_Str32(data):
    hex_str = '{:08X}'.format(data*100)
    data_1, data_2, data_3, data_4 = hex_str[:2], hex_str[2:4], hex_str[-4:-2], hex_str[-2:]
    return  int(data_1, base=16), int(data_2, base=16), int(data_3, base=16), int(data_4, base=16)

def Hex_Str64(data):
    hex_str = '{:016X}'.format(data*100)
    data_1, data_2, data_3, data_4, data_5, data_6, data_7, data_8 =hex_str[:2], hex_str[2:4], hex_str[4:6], hex_str[6:8],\
        hex_str[-8:-6], hex_str[-6:-4], hex_str[-4:-2], hex_str[-2:]
    return  int(data_1, base=16), int(data_2, base=16), int(data_3, base=16), int(data_4, base=16),\
        int(data_5, base=16), int(data_6, base=16), int(data_7, base=16), int(data_8, base=16)

def Str_Hex16(data):
    Str= data[0]+data[1]
    return int(Str,16),Str

def Str_Hex32(data):
    Str = data[0] + data[1] + data[2] + data[3]
    return int(Str,16),Str

def Str_Hex64(data):
    Str = data[0] + data[1] + data[2] + data[3]+ data[4] + data[5] + data[6] + data[7]
    return int(Str,16),Str    

print(Hex_Str16(255))
print(Hex_Str32(255))
print(Hex_Str64(255))

data = ['0f','ff']
data_1 = ['00','00','0f','ff']
data_2 = ['00','00','00','00','00','00','0f','ff']
print(Str_Hex16(data))
print(Str_Hex32(data_1))
print(Str_Hex64(data_2))

The results are as follows

(99, 156)
(0, 0, 99, 156)
(0, 0, 0, 0, 0, 0, 99, 156)
(4095, '0fff')
(4095, '00000fff')
(4095, '0000000000000fff')

Read More: