| ROTP(1) | User Commands | ROTP(1) |
NAME¶
rotp - generate HOTP and TOTP one-time passwords
SYNOPSIS¶
rotp [-t|-m] [-s secret] [-c counter] [-d algorithm]
DESCRIPTION¶
rotp prints a one-time password for a shared secret. The secret is RFC 4648 Base32 (A–Z and 2–7). The default mode is time-based TOTP (RFC 6238), with a 30 second period, six digits, and SHA-1. --hmac selects counter-based HOTP (RFC 4226).
This command is the command-line interface of the rotp Ruby library. The library also builds otpauth:// provisioning URIs for authenticator applications.
OPTIONS¶
- -s, --secret [SECRET]
- Shared Base32 secret. Required when generating a password.
- -c, --counter [COUNTER]
- Counter for HOTP. The default is 0.
- -t, --time
- Use time-based OTP (RFC 6238). This is the default.
- -m, --hmac
- Use counter-based HMAC OTP (RFC 4226).
- -d, --digest [ALGORITHM]
- Digest passed to OpenSSL. The default is sha1. sha256 and sha512 are accepted.
- -h, --help
- Show the help message.
EXAMPLES¶
Print the current TOTP for the RFC 6238 test secret:
rotp --secret JBSWY3DPEHPK3PXP
Print HOTP for counter 1234. The secret is 32 A characters, and the code is 161024:
rotp --hmac --secret AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --counter 1234
Print the current TOTP using SHA-256:
rotp --secret JBSWY3DPEHPK3PXP --digest sha256
SEE ALSO¶
RFC 4226, RFC 6238
HTML documentation is installed under /usr/share/doc/ruby-rotp/.
| October 2026 | rotp 6.4.0 |