didasy / shash

A no-nonsense golang package to create random string

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Coverage Status GoDoc Go Report Card

Shash

A no-nonsense golang package for creating random string

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.

Benchmark

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

About

A no-nonsense golang package to create random string

License:MIT License


Languages

Language:Go 100.0%