hotp

package module
v0.0.0-...-506b2f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2020 License: Zlib Imports: 3 Imported by: 0

README

HOTP

A minimal go implementation of the HOTP and TOTP algorithms.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hotp

func Hotp(key []byte, counter int64, digits int) int

Hotp calculates the hotp value for the given counter using the given key. The number of digits for the output code is provided by digits.

func Totp

func Totp(key []byte, counter, epoch, duration int64, digits int) int

Totp calculates a Totp value using the key and number of digits supplied. Counter is the current Unix time, epoch is a relative epoch (can be 0). Duration is how long the code will remain valid (in seconds).

func Truncate

func Truncate(sum []byte, digits int) int

Truncate is the Truncation function for Hotp and Totp code generation defined in RFC 4226. Sum is the 20-byte HMAC-SHA1 output, and digits is the number of digits for the output code.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL