1
0
Fork
You've already forked totp
0
  • C 79.9%
  • Shell 13.1%
  • Roff 7%
Find a file
2026年04月28日 22:37:25 +02:00
bin Write the uri2totp manual 2026年04月27日 20:40:04 +02:00
po Add en@quot translations 2026年04月27日 21:46:51 +02:00
src Remove debug include 2026年04月28日 22:37:25 +02:00
.gitignore Ignore totp-arm64 2024年08月26日 23:00:23 +02:00
build Add -a to the build script 2026年04月27日 23:01:15 +02:00
install Update install script 2026年04月27日 21:05:48 +02:00
LICENSE Bump the license 2026年04月27日 22:46:47 +02:00
README.md Random fixes 2026年04月27日 20:40:01 +02:00
REFS Add a references file 2024年08月26日 23:39:12 +02:00
totp.1 Random fixes 2026年04月27日 20:40:01 +02:00

totp

totp is a command-line utility to generate TOTP keys from the command-line. This is very useful for integrating 2-factor authentication support into your existing password-management setup.

Documentation

Both the totp and uri2totp utilities are documented via the totp(1) and uri2totp(1) manual pages.

Build and Install

Building and installing totp is very simple:

$ ./build # Build the application
$ ./install # Install the built application

By default a generic binary is built, however those on x86-64 or ARM64 platforms that support SHA-1 extensions can build tailored profiles that make use of these CPU extensions:

 $ ./build -p arm64
 $ ./build -p x64

Usage

The totp utility reads TOTP secret keys from the standard input and prints the corresponding codes to the standard output. You can use multiple keys:

$ printf '%s\n' 7KFSJ562KJDK23KD 7YNEG7J3XBIVYR54 | totp
546316
942303

You can also provide the keys as arguments:

$ totp 7KFSJ562KJDK23KD 7YNEG7J3XBIVYR54
546316
942303

By default it is assumed that the TOTP codes have a length of 6 and are valid for 30 seconds. You can change both of these parameters using the -d and -p respectively, if required:

$ totp -d8 -p60 7KFSJ562KJDK23KD 7YNEG7J3XBIVYR54
71696020
18335070

uri2totp

Along with totp, this package also ships with the uri2totp script. That script is a wrapper around totp and trurl to turn TOTP URIs into codes:

$ uri2totp otpauth://totp/foo?secret=DEADBEEF&period=30&digits=5
69420