Skip to main content

Simple Crypt Dat

Super lightweight, secure local JSON file-based database encrypted with AES (Fernet) and derived keys using PBKDF2HMAC-SHA256. Perfect for desktop apps, Telegram bots, or lightweight scripts requiring password-protected data files.

Installation

Install using pip:

pip install simple-crypt-dat

Features

  • No Server Needed: Store data in a single local .dat file.
  • AES-128 in CBC mode + HMAC-SHA256: Handled via standard Cryptography Fernet.
  • PBKDF2 Key Derivation: Automatically derives keys using 100,000 iterations and a cryptographically secure random 16-byte salt saved directly inside the file header.
  • JSON Serializable: Store complex Python lists, dicts, strings, and numbers easily.
  • Password retry friendly: Raises custom InvalidPasswordError when decryption fails.

Quick Start

1. Save Encrypted Data

from simple_crypt_dat import EncryptedFileDB

# Initialize DB with the target file path
db = EncryptedFileDB("secrets.dat")

# Any JSON-serializable Python structure
secret_accounts = [
    {"user": "admin", "token": "abc123xyz"},
    {"user": "moderator", "token": "pqr456lmn"}
]

# Encrypt and save with a password
db.save(secret_accounts, password="MySuperSecretPassword")
print("Encrypted data saved successfully to secrets.dat!")

2. Load and Decrypt Data

from simple_crypt_dat import EncryptedFileDB, InvalidPasswordError

db = EncryptedFileDB("secrets.dat")

try:
    # Load and decrypt using the correct password
    data = db.load(password="MySuperSecretPassword")
    print("Decrypted Data:", data)
    
except InvalidPasswordError:
    print("Error: The password entered is incorrect!")
except FileNotFoundError:
    print("Error: Database file not found.")

License

MIT License.

Metadata

Release files for simple-crypt-dat 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-crypt-dat 1.0.0
File Size Uploaded Provenance Actions
simple_crypt_dat-1.0.0.tar.gz 4.7 kB Without provenance Details for simple_crypt_dat-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-crypt-dat 1.0.0
File Interpreter ABI Platform Actions
simple_crypt_dat-1.0.0-py3-none-any.whl Python 3 none any Details for simple_crypt_dat-1.0.0-py3-none-any.whl

Total release size: 9.8 kB

Release files / simple_crypt_dat-1.0.0.tar.gz

Download URL simple_crypt_dat-1.0.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f9122c765ff6bde04d4aaae9ff1813ba0a99b0a1c583029e904bb9e699c08bc1
BLAKE2b-256 checksum
How to use checksums
73643c1147ac374596f7ac11b5391dac339257f343e2a8e8f4e2a8019d13c246
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / simple_crypt_dat-1.0.0-py3-none-any.whl

Download URL simple_crypt_dat-1.0.0-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aef0c86929dcfe8a5953e345d16e605a964401c100489bfa33530afe36c853ed
BLAKE2b-256 checksum
How to use checksums
fb66a5a7fe66aae60379bc000289b47788042e7a143b78d1382f3629abdab32a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for simple-crypt-dat 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page