Skip to main content

Simple OTP generation and verification toolkit

Project description

# otp-toolkit

A lightweight Python utility for generating and verifying OTPs (One-Time Passwords).

## Features
- Secure OTP generation
- Expiry handling
- SHA256 hashing
- Framework independent (works with Django, Flask, FastAPI)

## Installation
```bash
pip install otp-toolkit

## Example

from otp_toolkit import generate_otp, hash_otp, verify_otp

# Step 1: Generate OTP
otp, expires_at = generate_otp(length=6, expires_in=300)
hashed_otp = hash_otp(otp)

# Send `otp` to user via email/SMS (not shown here)

# Step 2: Verify OTP entered by user
user_input = "123456"

if verify_otp(user_input, hashed_otp, expires_at):
print("Login successful")
else:
print("Invalid or expired OTP")


Change Log
=============

0.1.1 (02/02/2026)
------------------
- Improved README with detailed usage examples
- Added real-world OTP flow examples

0.1.0 (02/02/2026)
------------------
- First release
- Secure OTP generation
- OTP expiry handling
- OTP hashing and verification

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otp_toolkit-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file otp_toolkit-0.1.1.tar.gz.

File metadata

  • Download URL: otp_toolkit-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for otp_toolkit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4a2d0e2670efd4d85c157b29662473d0f5ebad96b950346c7d66bc5aca1c293c
MD5 0e2ddda2f439b6b7e0c3beedbcfe3e4c
BLAKE2b-256 470c199b23e8ec8ab0e87b2a7f567215bf79abafcb1f922b9c362b7260579f77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page