Skip to content

Instantly share code, notes, and snippets.

@TheBits
Created July 14, 2021 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheBits/e58266fbc797447ea4130c94e0a276da to your computer and use it in GitHub Desktop.
Save TheBits/e58266fbc797447ea4130c94e0a276da to your computer and use it in GitHub Desktop.
siphash
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
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
-- 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