1
0
Fork
You've already forked TOTP
0
No description
  • C 89.9%
  • Shell 7.3%
  • Makefile 2.8%
Find a file
Anton Kling ca5dddcdfc
Added test cases.
These test cases come from https://www.rfc-editor.org/rfc/rfc6238#appendix-B
and helped find the Y2K38(32 bit overflow) bug.
2023年03月03日 22:38:54 +01:00
SHA1 @df6f889d38 Updated SHA1 repo as it had bug fixes for 32 bit versions. 2023年01月18日 21:21:54 +01:00
.clang-format Fix code formatting using clang-format 2023年03月01日 14:52:04 +01:00
.gitmodules First commit 2022年05月22日 23:33:37 +02:00
base32.c Change license from 2 Clause BSD to 0 Clause BSD 2023年02月26日 17:21:52 +01:00
base32.h Fix code formatting using clang-format 2023年03月01日 14:52:04 +01:00
dmenu_select.sh Change how TOTP secret is provided. 2023年02月28日 15:24:32 +01:00
hmac.c Fix code formatting using clang-format 2023年03月01日 14:52:04 +01:00
hmac.h Fix code formatting using clang-format 2023年03月01日 14:52:04 +01:00
hotp.c Change license from 2 Clause BSD to 0 Clause BSD 2023年02月26日 17:21:52 +01:00
hotp.h Fix code formatting using clang-format 2023年03月01日 14:52:04 +01:00
LICENSE Change how TOTP secret is provided. 2023年02月28日 15:24:32 +01:00
Makefile Fixed a few warnings so that the program builds 2023年02月28日 15:26:11 +01:00
README.md Added test cases. 2023年03月03日 22:38:54 +01:00
test.sh Added test cases. 2023年03月03日 22:38:54 +01:00
test_cases.txt Added test cases. 2023年03月03日 22:38:54 +01:00
totp.c Fix overflow from using atoi() instead of atoll(). 2023年03月03日 22:28:23 +01:00

Simple TOTP

A super simple application that takes in a TOTP secret key and returns the TOTP code.

This application is intended to be used in combination with other utilities. A example is included in the file dmenu_select.sh which will give you a dmenu prompt to select any of the files in ~/.config/totp/ that will contain TOTP keys. It will then put the TOTP token of said file in the clipboard.

Install

git clone --recurse-submodules https://github.com/0xc1f1/totp
cd totp
make && make install

Usage

totp -t [UNIX time] -d [digit] -i [interval] -h(print this message) [file containing the secret]

Either a file containing the TOTP secret key can be given as the first argument. If no argument is supplied then it will by default read from stdin.

Example(s)

totp ./secret
echo JBSWY3DPEHPK3PXP | totp

Testing

This program has been tested by the test cases for SHA1 provided by rfc6238. How the tests work can be seen in test.sh and the test cases can be seen in test_cases.txt.