We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The current implementation of hashing of strings is way too trivial.
pub fn (s string) hash() int { mut hash := int(0) for i := 0; i < s.len; i++ { // if key == 'Content-Type' { // println('$i) $hash') // } hash = hash * int(31) + int(s.str[i]) } return hash }
This warrants for a better and secure hash function.
The text was updated successfully, but these errors were encountered:
Any proposal?
Sorry, something went wrong.
I would tend to go for a variant of MurMur Hash. Also, a new file hash.v can be made in this retrospect.
MurMur
hash.v
This is the same hash function that's been used by Java for decades. It's battle tested, it's simple, it works:
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/lang/String.java
No branches or pull requests
The current implementation of hashing of strings is way too trivial.
This warrants for a better and secure hash function.
The text was updated successfully, but these errors were encountered: