Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement SipHash, use as our hashing function w/ 64bit hashvals
This switches our hashing function from "Jenkins's Lookup2" to SipHash. This adds a heavily modified version of https://github.com/majek/csiphash which has been modified to use a struct to store the state and allow us to add 64 bits at a time (two graphemes). It also has been modified to take 64 bit integers instead of pointers to bytes. Rewriting the CSipHash code to take a 64 bit integer is significant because it gives us a massive speedup due to much better inlining and less data copying. Some of this SipHash code was finished a month ago but only recently had I optimized it enough so that was just as fast as our current hashing function. It makes my hashing speed test file 0.5% slower, which is totally acceptable given it has been studied extensively, while our previous hash fn has not been studied for security to the best of my knowledge. We now use a 128-bit hashSecret stored in two MVMuint64's. Previously we only had a 32-bit length hashSecret (stored in a MVMuint32). The hash values are now 64-bits instead of 32-bits.
- Loading branch information
Showing
12 changed files
with
385 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
all: | ||
gcc -O3 test.c -g -Wall -Wextra -ggdb -o siphashtest -D MVM_CAN_UNALIGNED_INT64 && ./siphashtest | ||
gcc -O3 test.c -g -Wall -Wextra -ggdb -o siphashtest && ./siphashtest |
Oops, something went wrong.