Closed
Description
At the moment tuples have an IterBytes
implementation that combines the IterBytes
implementations of the contained elements. This means that ("aaa", "", "").to_bytes()
is equal to ("a", "a", "a").to_bytes()
, so their hash collides.
You can take advantage of this to easily find any number of hash collisions quickly:
value: ("aaa", "bbb", "ccc"), hash: 10071128569180783593
value: ("aaab", "bb", "ccc"), hash: 10071128569180783593
value: ("aaabb", "b", "ccc"), hash: 10071128569180783593
value: ("aaabbb", "", "ccc"), hash: 10071128569180783593
value: ("aaabbbc", "", "cc"), hash: 10071128569180783593
value: ("aaabbbcc", "c", ""), hash: 10071128569180783593
I don't really know how to do this properly (implementing Hash
on containers).
Metadata
Metadata
Assignees
Labels
No labels