Coder Social home page Coder Social logo

otp_auth's Introduction

otp_auth Actions Status

A set of TOTP and HOTP examples that utilize MT64

Compile the code

./compile.sh

Create the shared secret key file

This is your secret key. Keep it private.
This file will seed the MT PRNG.

./gen_secret.sh: <openssl|dd> <file>

./gen_secret.sh openssl 256.bin
<or>
./gen_secret.sh dd 256.bin

Static Key

Run the MT64 to generate a static key based only on the secret keyfile.
This is just used to demonstrate the usage of the MT64 algorithm.
This will not produce a "One-Time" value. The input will not be manipulated.
It will reproduce consistent output from the same input.
Set the spin value to any unsigned integer.

./static_key.exe: <SECRET FILE> <SPIN VALUE>

./static_key.exe 256.bin 1000000

Time-based OTP

The totp example will use the current time to manipulate the MT seed.

./totp.exe: <SECRET FILE> <SPIN VALUE>

./totp.exe 256.bin 1000000
TOTP: B4DE50FC4428E12A6211A64C59244FE168B7FF0BD800056DD353EF9CEA6E59A9 (valid for   34s)
<wait 60s>
./totp.exe 256.bin 1000000
TOTP: EE7A8C7603AE9E38DD9FA38E8BBE75F8735B2417159C55D338621C9A66C95ED7 (valid for   35s)

Counter-based OTP

The hotp example will use an external counter value to manipulate the MT seed.
Currently any resyncing and validation window handling is not part of this code.

./hotp.exe: <SECRET FILE> <SPIN VALUE>

HOTP_COUNTER=47 ./hotp.exe 256.bin 1000000
HOTP: 9ECFCD099E264C6CAFD09FFBB6B6D09C1A0D079AC32B8FF2A719294C30AC1630

HOTP_COUNTER=48 ./hotp.exe 256.bin 1000000
HOTP: 43E55DFDFF921E45EC494A18CECB7201B550E0818882D0200AFEE950C6D58975

Design Decisions

This code was not designed to be compliant with any RFC or specification. It was strictly designed to generate OTP codes for use in an external authentication system. Currently the output is 32 bytes of binary data (represented as 64 hex digits). This can be adjusted higher or lower by changing OUTPUT_ULONGS in main.c

More Info

otp_auth's People

Contributors

fullaxx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.