Closed thanodnl closed 8 years ago
Looks good! The only thing missing is a test to make sure they're validated when set through SetLocalLabel
/ SetLocalLabels
(but you're probably adding it after the tests are added and merged in from #167)
I have change checksum calculation to write the size (in bytes) of the key and value prior to their respective bytes in the buffer that is fingerprinted. This prevents hash collisions that would have been caused by the same input. This diff is now not needed anymore.
This PR hardens the checksumming algorithm behind labels by preventing the easy forging of checksum collisions. The labels checksum is calculated by
hash(key + "=" + value)
. By disallowing applications to use the=
in their keys it is non-trivial to create a hash collision.Since the hashes are xorred for order independence having the same hash twice effectively negates a certain value in the checksum.