Skip to content
/ cOTP Public

lightweight, cross-platform implementation of TOTP and HOTP in C, designed for embedded systems, desktop, and server applications.

License

Notifications You must be signed in to change notification settings

bielskij/cOTP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cOTP

Lightweight, cross-platform implementation of HOTP and TOTP in C, designed for embedded systems, desktop, and server applications. It is written in pure C and does not depend on any external libraries.

The user only needs to provide SHA-related methods, as they are wrapped in an abstraction layer. Accordingly, any implementation can be used, such as OpenSSL or hardware-accelerated versions on a supported platform.

Usage

cotp-tool

This is a simple tool built on top of the cOTP library, which allows you to:

  • Generate the current TOTP/HOTP code
  • Generate an otpauth URI that can be encoded as a QR code

Example:

  • Generate current code and otpauth URI:
SECRET=$(openssl rand 32 | base32);  ./tool/cotp-tool --algo sha256 -s $SECRET -t totp -p 30 -d 6 -S $(date -u +%s) -u -n example@domain
  • Generate a QR code:
qrencode -t png -o code.png "otpauth://totp/example%40domain?secret=VJMODH2ICVHLZK4CRWONBW3ZR7V72PDKLMMOWP6ALMGJGW5QTNWA&period=30&digits=6&algorithm=SHA256"

image info

About

lightweight, cross-platform implementation of TOTP and HOTP in C, designed for embedded systems, desktop, and server applications.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published