Skip to main content

simple encode decode w/ private key, based on the base64 encode and decode.

Initially developed for turning database ID’s into URL’s without exposing the ids in the url, or having a bot iterate over the values.

Also useful for storing passwords which need to be converted back to clear text, in alphanumeric form given a secret word. This is NOT encryption nor a hash. This is NOT cryptographically safe. For that an SSL public/private key pair is preferred. For situations where the encoded string is already protected by a privileged account, and the secret key is stored in a configuration file which is also protected by a privileged login, this system is secure. It is secure by virtue of having all its elements secure, and mitigates the risk of compromise of either one of those vectors (but not both).

This is good for websites which store the secret key in a configuration file on disk, and the encoded word in a database (accessible by a different user), and where both values are not in transactional memory except for the duration of decoding and using the decoded string, which should be immediate.

Requires Python 2.4 or greater

>>> from simpleencode import encode, decode, mksecret
>>> secret_key = mksecret()
>>> secret_key
"{iIb'd/y!%w$'BDL&6NkWf`LeyZvp+}6QFm3~sBQjP)[!8xZ}a"
>>> encoded = encode("Some Text", secret_key)
>>> encoded
'S1lwA3QLQhwBcRJcUxs5fQNSekZjNjwREzFzNSthFh9kNj5PSzl6Cih6HxtWa1lvKhE='
>>> decode(encoded, secret_key)
'Some Text'
>>>

Metadata

Release files for simpleencode 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 simpleencode 1.0.0
File Size Uploaded Provenance
simpleencode-1.0.0.tar.gz 4.3 kB Without provenance Details

Release files / simpleencode-1.0.0.tar.gz

Download URL simpleencode-1.0.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b95392f095db4dbcf1908ccc8437f5f526ad829a2124a3ac48c7eccd843cbf3b
BLAKE2b-256 checksum
How to use checksums
309962e60f9a6ab9d55487a3a0d9090424d828f13d9120a5a0eebcec615c5e79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for simpleencode 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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file 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