totp

package
v0.0.0-...-83ebf3d Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Totp

func Totp(instant time.Time, key []byte) uint32

* - Divide the current Unix timestamp by 30 - Encode it as a 64-bit big endian integer - Write the encoded bytes to a SHA-1 HMAC initialized with the TOTP shared key - Let offs = hmac[-1] & 0xF - Let hash = decode hmac[offs .. offs + 4] as a 32-bit big-endian integer - Let code = (hash & 0x7FFFFFFF) % 1000000

Credits: https://drewdevault.com/2022/10/18/TOTP-is-easy.html *

Types

This section is empty.

Jump to

Keyboard shortcuts

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