func GenerateHOTP(digits int, randCounter bool) (*HOTP, error) {
	key := make([]byte, sha1.Size)
	_, err := io.ReadFull(PRNG, key)
	if err != nil {
		return nil, err
	}

	var counter uint64
	if randCounter {
		ctr, err := rand.Int(PRNG, big.NewInt(int64(math.MaxInt64)))
		if err != nil {
			return nil, err
		}
		counter = ctr.Uint64()
	}

	return NewHOTP(key, counter, digits), nil
}
func GenerateHOTP(digits int, randCounter bool) (*HOTP, error) {
	key := make([]byte, sha1.Size)
	_, err := io.ReadFull(PRNG, key)
	if err != nil {
		return nil, err
	}

	var counter uint64
	if randCounter {
		ctr, err := rand.Int(PRNG, big.NewInt(int64(math.MaxInt64)))
		if err != nil {
			return nil, err
		}
		counter = ctr.Uint64()
	}

	return NewHOTP(key, counter, digits), nil
}
func GenerateHOTP ( digits int , randCounter bool ) ( * HOTP , error ) { key := make ( [ ] byte , sha1 . Size ) _ , err := io . ReadFull ( PRNG , key ) if err != nil { return nil , err } var counter uint64 if randCounter { ctr , err := rand . Int ( PRNG , big . NewInt ( int64 ( math . MaxInt64 ) ) ) if err != nil { return nil , err } counter = ctr . Uint64 ( ) } return NewHOTP ( key , counter , digits ) , nil }
// GenerateHOTP will generate a randomised HOTP source; if the
// randCounter parameter is true, the counter will be randomised.
GenerateHOTP will generate a randomised HOTP source ; if the randCounter parameter is true the counter will be randomised .