DB-Hash-Utils
A high-performance Python toolkit designed for secure database record hashing, transaction integrity verification, and data-at-rest obfuscation. Optimized for integration with relational database management systems (RDBMS) and desktop GUI frameworks.
Core Architecture & Features
The library addresses critical data safety requirements in modern software engineering courses, focusing on the following sub-systems:
- Row-Level Integrity Validation: Generates advanced salt-stretched block checksums to detect unauthorized backend data tampering (direct SQL injections bypassing the GUI layer).
- Cryptographically Secure UUIDs: Provides collision-resistant unique identifier generation for primary keys (PK) using internal system entropy.
- Data Alignment Matrix: Ensures automated bit-alignment and padding configurations based on industry-standard database block sizes.
Installation
Install the package within your virtual environment using setuptools:
pip install .
Production Architecture & Usage
1. Generating Row Checksums (Before SQL Insert/Update)
To protect sensitive fields (such as access tokens, configuration parameters, or transaction values) before pushing them to the database, generate a secure block-checksum:
from db_hash_utils import generate_record_checksum
# Extract parameters from PyQt/Tkinter input forms
user_payload = "db_admin_secure_credentials_2026"
session_salt = "AppSecuritySaltValue"
# Generate block aligned integrity token
integrity_token = generate_record_checksum(
payload=user_payload,
record_salt=session_salt
)
# Execution payload is now safe to store in TEXT / BLOB columns
# cursor.execute("INSERT INTO system_config (config_value) VALUES (?)", (integrity_token,))
2. Transaction Integrity Verification (After SQL Select)
Verify record state consistency during application runtime to ensure data has not been modified directly in the database:
from db_hash_utils import verify_record_integrity
# Fetch token from database cursor
fetched_token = "..." # Retrieved from DB row
session_salt = "AppSecuritySaltValue"
try:
# Reconstruct and validate data state matrix
validated_data = verify_record_integrity(
checksum_hash=fetched_token,
record_salt=session_salt
)
print(f"State Validated. Core Payload: {validated_data}")
except Exception as e:
print(f"Critical Error: Database integrity violation detected! Code: {e}")
3. Primary Key UUID Generation
Replace standard auto-increment integer IDs with unpredictable, collision-free system vectors:
from db_hash_utils import generate_secure_uuid
# Generate an optimal 16-byte hex seed for Relational DB Primary Keys
new_primary_key = generate_secure_uuid(length=16)
Metadata
Release files for db-hash-utils 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| db_hash_utils-1.0.2.tar.gz | 1.9 MB | Without provenance | Details for db_hash_utils-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| db_hash_utils-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for db_hash_utils-1.0.2-py3-none-any.whl |
Total release size: 3.9 MB
Release files / db_hash_utils-1.0.2.tar.gz
| Download URL | db_hash_utils-1.0.2.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7416b03aee01deb11a3e0fb97dfb6fc7657cecadbdc61685228574ad0ac6c700
|
|
BLAKE2b-256 checksum How to use checksums |
04a36bbf2275cf1ab641c9fb040761386982ba89c006e5fbaa83540d5b254479
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / db_hash_utils-1.0.2-py3-none-any.whl
| Download URL | db_hash_utils-1.0.2-py3-none-any.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
022ce496a2925df947f8069e69f8c203cc44cf8db861601b38748f2c947a27f3
|
|
BLAKE2b-256 checksum How to use checksums |
583ed0c05679ccc1500daaec1eb2c913e5041404821ac58be60bfa6560438720
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Security for db-hash-utils 1.0.2
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.