dpkt
dpkt copied to clipboard
Question about checksum generated
Hi there
I didnt rly find out a method of generating checkusum value with dpkt
I need to change some hex in payload and once I pack new payload, the checksum needs to be updated as well
Any way to calculate and generate a new checksum by itself?
thx
In general if you set the checksum to zero (pkt.sum=0
), then serialize the packet (ie. call bytes(pkt)
) it will be auto-recalculated. See the code here: https://github.com/kbandla/dpkt/blob/master/dpkt/ip.py#L90