ALogin
Lightweight Python authentication library with SHA-256 hashing and a zero-dependency JSON user store.
Features
Quickest way to start
pip install alogin
from alogin import create_account, login_account create_account() login_account()
Installation
Install ALogin from PyPI — no external dependencies needed.
Requirements
Python 3.6 or higher. ALogin only uses modules from the standard library (hashlib, json, getpass).
Install via pip
pip install alogin
Install from source
git clone https://github.com/ADEEP13/alogin.git cd alogin pip install -e .
Verify installation
python -c "import alogin; print('ALogin installed successfully')"python -m venv venv && source venv/bin/activate before installing.Quick start
Create an account and authenticate a user in under ten lines of Python.
Step 1 — create an account
Call create_account(). It prompts for an email and password, hashes the password, and writes the record to users.json.
from alogin import create_account create_account() # → Enter email: user@example.com # → Enter password: ******** # → Account created!
Step 2 — log in
Call login_account(). Returns True on success, False otherwise.
from alogin import login_account result = login_account() if result: print("Welcome back!")
Full example
from alogin import create_account, login_account create_account() authenticated = login_account() if authenticated: print("Access granted.") else: print("Access denied.")
API reference
Full reference for all public functions exported by ALogin.
Interactively prompts for a new user's email and password. Hashes the password with SHA-256 and writes the record to users.json. Raises a ValueError if the email is already registered.
| Parameter | Type | Description |
|---|---|---|
| No parameters — prompts via stdin. | ||
from alogin import create_account create_account() # returns None
Prompts for email and password. Hashes the input and compares it against the stored SHA-256 hash. Returns True if credentials match, False otherwise.
| Returns | Type | Description |
|---|---|---|
| result | bool | True on successful authentication, False on failure. |
result = login_account() # returns True or False
Security
How ALogin protects user credentials and what to be aware of in production.
Password hashing
All passwords are hashed using SHA-256 via Python's hashlib module before being written to disk. Plain-text passwords are never stored or logged.
Duplicate email protection
Each email address can only be registered once. Attempting to create a second account raises a ValueError before any write occurs.
JSON storage
User records are stored in a local users.json file. Ensure this file is excluded from version control.
users.json
Known limitations
SHA-256 without salting is vulnerable to rainbow table attacks. For stronger security, use bcrypt or argon2 in your own implementation.
Changelog
Full version history for ALogin.
- Resolved bugs in
__init__.py
- Exported both
create_account()andlogin_account()from the package - Cleaner import style — use
from alogin import create_account, login_account
- JSON-based user database
- Login authentication system
- Password hashing
- Duplicate email protection
Download stats
Live PyPI download data fetched automatically from pypistats.org — updated daily.
Daily downloads — last 90 days
Version distribution
Share of downloads by version over the last 90 days.