HumanToken is a human-friendly token generator. You can create tokens without ambiguous characters.
To install: go get github.com/lsmoura/humantoken
Generate(size int, r *rand.Rand)
-- generates a randomsize
string. Ifr
isnil
, a new random object based on the current time will be generated for you.TokenGenerator
interface has a single methodGenerate(size int)
. This method generates a random human token just like theGenerate
standalone counterpart. Use one of the available generators to get an implementation of the interface
NewGenerator(r *rand.Rand)
generates a new random generator. Ifr
is new, a new random generator will be created upon the creation of the interface.NewCryptoGenerator()
generates a new generator based on thecrypto/rand
go package. This generator takes no parameters.
This package is based on the human_token package by @brianhempel, originally written for the Ruby programming language.
This package was written by Sergio Moura