Documentation ¶
Overview ¶
Example (Mac) ¶
k := []byte("this is a secret key; you should generate a strong random key that's at least 32 bytes long") buf := []byte("and this is some data to authenticate") h := make([]byte, 32) d := NewShake256() d.Write(k) d.Write(buf) d.Read(h)
Output:
Example (Sum) ¶
buf := []byte("some data to hash") h := make([]byte, 64) ShakeSum256(h, buf)
Output:
Index ¶
- func AlphaNumByString(inString string, returnLen int) string
- func Float64ByString(inString string) float64
- func GetSha3ShakeSum256RandomGenerater(inString string) func(returnLen int) []byte
- func IntnByString(inString string, n int) int
- func MustSha3512File(path string) (b []byte)
- func New224() hash.Hash
- func New256() hash.Hash
- func New384() hash.Hash
- func New512() hash.Hash
- func NewGoRandByString(inString string) *rand.Rand
- func Sha3512(content []byte) []byte
- func Sha3512File(path string) (string, error)
- func Sha3512First16(content []byte) []byte
- func Sha3512ToHexString(content []byte) string
- func Sha3512ToHexString32(content []byte) string
- func Sha3512ToHexStringFromString(content string) string
- func ShakeSum128(hash, data []byte)
- func ShakeSum256(hash, data []byte)
- func Sum224(data []byte) (digest [28]byte)
- func Sum256(data []byte) (digest [32]byte)
- func Sum384(data []byte) (digest [48]byte)
- func Sum512(data []byte) (digest [64]byte)
- func Sum512Slice(data []byte) (digest []byte)
- type ShakeHash
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlphaNumByString ¶
func Float64ByString ¶
Example ¶
rangeMap := map[float64]int{} for i := 0; i < 800; i++ { out := Float64ByString(strconv.Itoa(i)) thisRange := out - math.Mod(out, 1.0/16) rangeMap[thisRange]++ } fmt.Println(len(rangeMap)) for thisRange, size := range rangeMap { fmt.Println(thisRange, size) }
Output:
func IntnByString ¶
Example ¶
rangeMap := map[int]int{} for i := 0; i < 1000; i++ { out := IntnByString(strconv.Itoa(i), 5) rangeMap[out]++ } fmt.Println(len(rangeMap)) for thisRange, size := range rangeMap { fmt.Println(thisRange, size) }
Output:
func MustSha3512File ¶
func NewGoRandByString ¶
func Sha3512File ¶
func Sha3512First16 ¶
func Sha3512ToHexString ¶
func Sha3512ToHexString32 ¶
func ShakeSum128 ¶
func ShakeSum128(hash, data []byte)
func ShakeSum256 ¶
func ShakeSum256(hash, data []byte)
func Sum512Slice ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.