mOTP is C based software for generate mOTP codes.

Rozhuk Ivan 725d675ba9 First release 3 ay önce
.github 725d675ba9 First release 1 ay önce
3rdparty 725d675ba9 First release 1 ay önce
src 725d675ba9 First release 1 ay önce
.clang-format 725d675ba9 First release 1 ay önce
.editorconfig 725d675ba9 First release 1 ay önce
.gitignore d483568c8a Initial commit 3 ay önce
.gitmodules 725d675ba9 First release 1 ay önce
LICENSE 725d675ba9 First release 1 ay önce
motp.project 725d675ba9 First release 1 ay önce
motp.workspace 725d675ba9 First release 1 ay önce
readme.md 725d675ba9 First release 1 ay önce

readme.md

Simple console mOTP tool

Build-macOS-latest Actions Status Build-Ubuntu-latest Actions Status

Rozhuk Ivan rozhuk.im@gmail.com 2024-2025

mOTP is C based software for generate Mobile-OTP codes.

Licence

BSD licence.

Donate

Support the author

  • GitHub Sponsors:
  • Buy Me A Coffee:
  • PayPal: PayPal
  • Bitcoin (BTC): 1AxYyMWek5vhoWWRTWKQpWUqKxyfLarCuz

Features

  • Allow set timezone while code genereation
  • Allow set time while code genereation

What is this for?

If you need to generate [one-time passwords] using the [Mobile-OTP / mOTP algorithm], from the command-line, without futzing around with your phone.

This is a self-proclaimed “standard” algorithm for one-time passwords. It is confusing, seemingly almost obsolete, and appears to mainly be used in German-speaking countries. You don't want to use this unless you are forced to interact with an existing system that uses such codes for 2FA.

How does it work?

The principle of the algorithm is [explained badly] and [implemented confusingly] but it's very simple: you have a token secret (an ASCII string, usually hexadecimal or alphanumeric) and a PIN (an ASCII string, usually 4 digits), and this is converted to a 6-digit code using:

counter = ASCII((UNIX epoch time) / 10s)
digest = MD5HEX(counter || secret || pin)
code = LEFT(digest, 6 characters)

Compilation

Linux

sudo apt-get install build-essential git fakeroot
git clone --recursive https://github.com/rozhuk-im/motp.git
cd motp/src
cc motp.c -O2 -I../3rdparty/liblcb/include/crypto/hash -lm -o motp

FreeBSD / DragonFlyBSD

sudo pkg install git
git clone --recursive https://github.com/rozhuk-im/motp.git
cd motp/src
cc motp.c -O2 -I../3rdparty/liblcb/include/crypto/hash -lm -o motp

Usage

help

motp     Simple console mOTP tool
Usage: motp [options]
options:
	-help, -? 		Show help
	-secret, -s <string>	Shared secret
	-pin, -p <string>	PIN
	-duration, -P seconds>	Code duration interval. Default: 10
	-length, -d <number>	Result code length. Default: 6
	-time, -t <string>	Time string, in one of formats: HTTP date / RFC 822, RFC 850, ANSI C, YYYY-MM-DD HH:MM:SS, Number of seconds since the Epoch (UTC)
	-tz, -T <string>	The timezone time zone offset from UTC. Will override time zone from 'time' string is set. Ex: +0100, -0500.

example

motp -s 'secret' -p '1111'