Begin to introduce commented out code, use metadata
This commit is contained in:
parent
f9ce0b92a6
commit
8b8f70e6a0
6 changed files with 585 additions and 478 deletions
|
|
@ -23,6 +23,8 @@ else:
|
|||
# create array with unsigned shorts,
|
||||
# sum it up -> results in 16 bit uint (?)
|
||||
s = sum(array.array("H", pkt))
|
||||
print("sum={}".format(s))
|
||||
# This step is understood
|
||||
|
||||
# (s & 0xffff) -> mask for 16 bit, truncate rest
|
||||
# (s >> 16) right shift by 16 bits
|
||||
|
|
@ -40,7 +42,6 @@ else:
|
|||
# over bits from the previous calculation
|
||||
s += s >> 16
|
||||
|
||||
|
||||
# according to https://stackoverflow.com/questions/8305199/the-tilde-operator-in-python
|
||||
# ~ is the bitwise complement operator in python
|
||||
# which essentially calculates -x - 1
|
||||
|
|
@ -65,3 +66,6 @@ if __name__ == '__main__':
|
|||
pkt_bytes = pkt.encode('utf-8')
|
||||
print(pkt_bytes)
|
||||
print(checksum(pkt_bytes))
|
||||
|
||||
ipv4 = "AAAA"
|
||||
ipv6 = "BBAA"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue