This module provides functionality for generating time-based ephemeral passwords (TOTP) based on a master key following the RFC 6283 specification.
It includes functions for generating the master key, decrypting it, generating counters, truncating hash values, computing TOTP values, and generating ephemeral keys.
It includes functions for generating the master key, decrypting it, generating counters, truncating hash values, computing TOTP values, and generating ephemeral keys.
To run this project, ensure you have:
Python3
Pip3
Make
- Clone the repository:
git clone https://github.com/louisabricot/OTP
cd OTP
- Install the required packages:
make install
- Setup the project:
make
The script can be run in two modes:
Generate the master key from a 64-character hexadecimal value.
Generate a time-based ephemeral password from the master key.
- To generate the master key:
python script.py --master-key <64-character-hexadecimal-value>
- To generate a time-based ephemeral password:
python script.py --key [-d <digits>] [-v]
Options
--master-key, -m <64-character-hexadecimal-value>:
Generate the master key from a 64-character hexadecimal value.
--key, -k:
Generate a time-based ephemeral password from the master key.
--digits, -d <digits>:
The length of the TOTP password (default is 6 digits).
--verbose, -v:
Display detailed steps while generating the password.
Example
Generate a master key:
python script.py --master-key 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
Generate a time-based ephemeral password:
python script.py --key -d 6 -v
To run tests:
make test