Skip to content

Clarify HashMap docs discussion of DoS protection #33817

Closed
@aturon

Description

@aturon

Today, the HashMap docs say:

The hashes are all keyed by the thread-local random number generator on creation by default. This means that the ordering of the keys is randomized, but makes the tables more resistant to denial-of-service attacks (Hash DoS). No guarantees are made to the quality of the random data. The implementation uses the best available random data from your platform at the time of creation. This behavior can be overridden with one of the constructors.

While this is accurate, it's burying the lede: we should say much more clearly what the tradeoffs are, and point more directly toward the custom hashing infrastructure. E.g.:

By default, HashMaps use a somewhat slow hashing algorithm that provides resistance to denial-of-service attacks (Hash DoS). For cases where DoS protection isn't needed, you can opt into a faster hasher by using some details here.

Metadata

Metadata

Assignees

Labels

E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions