python int to hex 2's complement
def to_hex(val, nbits):
return hex((val + (1 << nbits)) % (1 << nbits)).lstrip('0x')
print(to_hex(-1998995181, 16)) # c113
print(to_hex(-1998995181, 32)) # 88d9c113
print(to_hex(-1998995181, 64)) # ffffffff88d9c113