alex14fr / mini_totp_client

A small HOTP/TOTP SHA1 client.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mini_totp_client

(c) 2021 Alexandre Janon

A small HOTP/TOTP SHA1 client written in C99, without dependencies.

Compile with make.

Usage:

./mini_totp_sha1 <base32 secret> [<interval=30>] [<digits=6>] [<UNIX timestamp=now>]

To use HOTP codes, set interval to 1 and UNIX timestamp to the HOTP counter.

Test with: (see RFC6238 Appendix B)

$ ./mini_totp_sha1 $(printf 12345678901234567890|base32) 30 8 59
94287082

For convenience we include a tiny and rough Simple Network Time Protocol (RFC4330) client which echoes UNIX timestamp given by server pool.ntp.org.

SNTP and TOTP are composed by the included shell script sntp_totp_sha1 :

$ ./sntp_totp_sha1 $(printf 12345678901234567890|base32) 30 8
95142869

About

A small HOTP/TOTP SHA1 client.

License:BSD 2-Clause "Simplified" License


Languages

Language:C 75.5%Language:HTML 22.7%Language:Makefile 1.0%Language:Shell 0.8%