Documentation ¶
Index ¶
Constants ¶
View Source
const ( // Interval for totp tokens Interval = 30 // PinModulo pin mod value PinModulo = 1000000 // DefaultBase32String base 32 characters DefaultBase32String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" )
Variables ¶
View Source
var ( // ZerosOnRightModLookup lookup table for calculating number of trailing zeroes // Integer.numberOfTrailingZeros // http://stackoverflow.com/questions/5471129/number-of-trailing-zeros // http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightModLookup ZerosOnRightModLookup = []int{ 32, 0, 1, 26, 2, 23, 27, 0, 3, 16, 24, 30, 28, 11, 0, 13, 4, 7, 17, 0, 25, 22, 31, 15, 29, 10, 12, 6, 0, 21, 14, 9, 5, 20, 8, 19, 18, } )
Functions ¶
func GenerateResponseCode ¶
GenerateResponseCode 生成密码
func GetTotpCode ¶
GetTotpCode 获取totpcode, 这里会生成3个code,当前时间,前30s,后30s 为了预防客户端跟服务端的时间差太大
Types ¶
type Base32Decode ¶
type Base32Decode struct {
// contains filtered or unexported fields
}
Base32Decode struct
func DefaultNewBase32Decode ¶
func DefaultNewBase32Decode() *Base32Decode
DefaultNewBase32Decode decoder
func NewBase32Decode ¶
func NewBase32Decode(encode string) *Base32Decode
NewBase32Decode 新建base32解码器
Click to show internal directories.
Click to hide internal directories.