But beware—it's very risky to use one of these functions in an environment where a user can provide (or manipulate) keys. They could generate a collision and modify the value of a key they should not have access to. They could even create a denial of service attack using it.
I do not clearly understand this - hash is only determining bucket in which value sits. If key is different but has same hash, then bucket has two values with different keys - but it will not overwrite value of key with same hash, if key is different - the problem is rather with DoS - when too many keys has same hash - then hash table performance degrades from O(1) to O(n) or even worst (depending on implementation of Hash Table)