I have a text file with a list of numbers that look like this
I'm trying to convert that list into hexidecimal numbers that look like this but all I get is 'truncated numbers. How do I convert that list to look like this?
The output in terminal when converting is like "fcccccccca" and says "truncated over 20 digit" (I'm paraphrasing). I'm trying to get a 64 character hex.
It looks like you're trying to convert large integers to hexadecimal strings, zero-padded to always show the full 256-bit hexadecimal representations:
n = 295147905179352825855
result = '{:0{}x}'.format(n, 64)
print(result)
Output:
00000000000000000000000000000000000000000000000fffffffffffffffff
Or if you prefer f-string notation:
result = f'{n:0{64}x}'
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments