Created
July 14, 2021 19:41
-
-
Save TheBits/e58266fbc797447ea4130c94e0a276da to your computer and use it in GitHub Desktop.
siphash
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
package main | |
import ( | |
"fmt" | |
"github.com/aead/siphash" | |
"encoding/hex" | |
) | |
func main() { | |
key, _ := hex.DecodeString("00000000000000000000000000000001") | |
h, _ := siphash.New64(key) | |
h.Write([]byte("abc")) | |
fmt.Println(h.Sum64()) | |
} | |
// 14305882064097596351 |
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
import siphash | |
key = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' | |
sip = siphash.SipHash_2_4(key) | |
sip.update(b'abc') | |
sip.hash() | |
# 14305882064097596351 |
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
-- yandex database | |
select Digest::SipHash(0,0x100000000000000,"abc") ; | |
-- 14305882064097596351 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment