mirror of
https://codeberg.org/scip/tablizer.git
synced 2025-12-18 21:11:03 +01:00
added
This commit is contained in:
26
vendor/github.com/glycerine/zygomys/zygo/blake2.go
generated
vendored
Normal file
26
vendor/github.com/glycerine/zygomys/zygo/blake2.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
package zygo
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"github.com/glycerine/blake2b"
|
||||
)
|
||||
|
||||
// Blake2bUint64 returns an 8 byte BLAKE2b cryptographic
|
||||
// hash of the raw.
|
||||
//
|
||||
// we're using the pure go: https://github.com/dchest/blake2b
|
||||
//
|
||||
// but the C-wrapped refence may be helpful as well --
|
||||
//
|
||||
// reference: https://godoc.org/github.com/codahale/blake2
|
||||
// reference: https://blake2.net/
|
||||
// reference: https://tools.ietf.org/html/rfc7693
|
||||
//
|
||||
func Blake2bUint64(raw []byte) uint64 {
|
||||
cfg := &blake2b.Config{Size: 8}
|
||||
h, err := blake2b.New(cfg)
|
||||
panicOn(err)
|
||||
h.Write(raw)
|
||||
by := h.Sum(nil)
|
||||
return binary.LittleEndian.Uint64(by[:8])
|
||||
}
|
||||
Reference in New Issue
Block a user