tl;dr: If you need to resist hash-collision DoS attacks, and you are using weak-table, you should probably specify your BuildHasher explicitly.
There is a Cargo feature in weak-table called ahash, which changes the default hasher implementation to ahash. The ahash hash function is faster than the standard std::hash::RandomState, but is probably less secure against hash collision DoS attacks on systems without hardware AES.
The trouble arises in larger projects, where some crates may have security requirements for weak-table, and erroneously believe that they are secure because they have not enabled ahash. But the ahash feature may be enabled by some other crate -- or the user may have simply built with --all-features. In either of these cases, every crate will get ahash as its default hasher.
It would probably be better if the ahash feature did not change the default.
Edited: --all-features is not recursive.
tl;dr: If you need to resist hash-collision DoS attacks, and you are using
weak-table, you should probably specify yourBuildHasherexplicitly.There is a Cargo feature in
weak-tablecalledahash, which changes the default hasher implementation toahash. Theahashhash function is faster than the standardstd::hash::RandomState, but is probably less secure against hash collision DoS attacks on systems without hardware AES.The trouble arises in larger projects, where some crates may have security requirements for weak-table, and erroneously believe that they are secure because they have not enabled
ahash. But theahashfeature may be enabled by some other crate-- or the user may have simply built with. In either of these cases, every crate will get--all-featuresahashas its default hasher.It would probably be better if the
ahashfeature did not change the default.Edited: --all-features is not recursive.