Answer the question
In order to leave comments, you need to log in
Using hash functions instead of internet checksum?
This is how the internet checksum (py) is calculated:
def checksum(data):
data = data.hex(' ')
hexinput = '0x'+data
hexinput = "".join(hexinput.split())
quads = [int(hexinput[i:i+4],16) for i in range(2, len(hexinput), 4)]
sumstuff = hex(sum(quads))
if len(sumstuff) > 6:
manip = str(sumstuff)
sumstuff = hex(int(manip[2],16)+int(manip[3:],16))
s = hex(int(sumstuff,16) ^ 0xffff)[2:]
return s
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question