When creating a StorageMap
, a hashing algorithm needs to be chosen for the StorageHasher
.
frame_support
provides a few options:
Identity
Blake2_128
Blake2_128Concat
Blake2_256
Twox64Concat
Twox128
Twox256
(edit: the non-*Concat
versions are being deprecated)
Where Identity
means using the key directly (with no hashing), Blake2_*
means using some variation of the BLAKE2 algorithm, and Twox*
means using some variation of the xxHash algorithm.
The question here is: what criteria would one take into account when choosing BLAKE2 vs xxHash for their StorageHasher
object? When to choose one over the other?