This package is very simple, just do
package main
import (
"fmt"
"github.com/JesusIslam/shash"
)
func main() {
h := shash.New(10)
r, _ := h.Generate()
fmt.Println(r)
}
The example will generate a base62 random string with length of 5 (default).
For the documentation see here.
To test, just run go test
, but you need to have gomega and ginkgo installed.
To install go get github.com/JesusIslam/shash
.
On i3-3217U @1.8GHz with go test -bench . -benchtime=5s -cpu 4
BenchmarkGenerate5-4 500000 15130 ns/op
BenchmarkGenerate16-4 200000 48357 ns/op
BenchmarkGenerate32-4 100000 98319 ns/op