Python OTP
Project description
che_guevara_otp
This module generates one-time passcodes that are based either on a counter or time using a secret key that is assumed known by server and client.
The counter-based passcodes are hash-based one-time passcodes (HOTP) and are defined in RFC 4226. The time-based passcodes are time-based one-time passcodes (TOTP) and are defined in RFC 6238. For HOTP, the pseudorandom function used is HMAC-SHA-1 and the associated counter should be incremented after each passcode generation. TOTP is HOTP with a specified time interval for validity. A common time interval is 30 seconds.
setup
pip install che_guevara_otp
module
HOTP passcodes can be generated in a way like the following:
>>> import che_guevara_otp
>>> secret = "XXXXXXXXXXXXXXXX"
>>> for nonce in range(0, 3):
... print(che_guevara_otp.HOTP(secret = secret, nonce = nonce))
...
561452
686073
840123
TOTP passcodes can be generated in a way like the following, where the default time interval is 30 seconds:
>>> import che_guevara_otp
>>> secret = "XXXXXXXXXXXXXXXX"
>>> print(che_guevara_otp.TOTP(secret = secret))
826402
display_che_guevara_otp.py
The script display_che_guevara_otp.py displays time-based one-time passcodes at 30 second intervals based on secrets stored in a specified file. The file is unencrypted plaintext so userspace encryption combined with other security is assumed. The contents of the secrets file should be of the following form:
OmegaBay: XXXXXXXXXXXXXXXXXXXXXXXX Missile Emporium: YYYYYYYYYYYYYYYYYYYYYYYY
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for che_guevara_otp-2018.1.15.1652.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a38c76aae3fd939f5894a6f793c9da7fb6c018a54ed997e904f848d853a2f35b |
|
MD5 | 31ebbffd35c88ae40cbcb2d2a1d55b2f |
|
BLAKE2b-256 | cd10c28b8d3e6d19e4cd1770cf41befe35e3c3fe97d201c63fed75fd48e6ce97 |