Null bytes in Python
We’re doing a lot of hashing and validation on our databases lately and I fooled myself into thinking that a byte representation of a str of 0s would be the same thing as a nullbyte * the number of zeroes.
But remember folks, a byte representation of a str of 64 zeroes:
does not make 64 null bytes:
Let that be a lesson to you!
# *-* coding: utf-8 -*- import hashlib nullbytes768 = b'\x00'*768 print(hashlib.sha3_256(nullbytes768).hexdigest())