Create reversible transformations to obscure sequential ID numbers.
Project description
Obscure
Showing a steadily increasing sequence of integer IDs leaks information to customers, competitors, or malicious entities about the number and frequency of customers, inventory, or orders. Some example include:
/customer/123
/order/308
From these, I would conclude that I am only your 123rd customer with the 308th order. How a customer or competitor would feel about this would differ. However, the point is do I really want others to know this information? In addition, by creating another account or order, I can estimate the rate of change within your systems.
This class will help obscure your sequential order by providing a reversible transformation to your numbers. By using different salts your transformations will be unique. In addition, the class gives some output helpers for hex, base32, and base64. There is one I call 'tame' as it removes the letters i and u to elimination some common offensive words.
Install
By far the simplest method is to use pip:
$ pip install obscure
Example
$python -m obscure --bits=64 --demo 0 1 2
>>> from obscure import FeistelCipher, Encoder
>>> cipher = FeistelCipher(bits=64)
# For a consistant transformations between instances,give a
# salt and small prime for the Feistel cipher's round function
>>> cipher = FeistelCipher(0x1234, 0xc101, bits=64)
>>> numeric_id = 1234
>>> cipher(numeric_id)
249699227
# Reverse the transformation
>>> cipher(cipher(numeric_id))
1234
# Use an Encoder to wrap the Feistel cipher
>>> encoder = Encoder(Feistel, "base32")
>>> encoder.encode(numeric_id)
"XXX"
>>> encoder.decode('XXX")
1234
License MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file obscure-1.0.4.tar.gz.
File metadata
- Download URL: obscure-1.0.4.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbbc72bab6b01ea52d74f69142cf135ca054f6631d6153ee8091b56d73fb6366
|
|
| MD5 |
e48073d651723bbc331cc730d9471e4d
|
|
| BLAKE2b-256 |
fa4f86fc355d96d4badf268063a18217ca821caf4ae1108ed64000f5fb18e826
|
Provenance
The following attestation bundles were made for obscure-1.0.4.tar.gz:
Publisher:
publish.yml on jidn/obscure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
obscure-1.0.4.tar.gz -
Subject digest:
cbbc72bab6b01ea52d74f69142cf135ca054f6631d6153ee8091b56d73fb6366 - Sigstore transparency entry: 761936107
- Sigstore integration time:
-
Permalink:
jidn/obscure@cb78445a1506ef05cfe2e8620c757e3155677de7 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/jidn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cb78445a1506ef05cfe2e8620c757e3155677de7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file obscure-1.0.4-py3-none-any.whl.
File metadata
- Download URL: obscure-1.0.4-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6350f43baae9fd26c4b2d8d8180e4bd6c20d5c6fb9986fe79282c25dbb716f16
|
|
| MD5 |
3fb01d6fc55cb4c15800af7e71ac6c5b
|
|
| BLAKE2b-256 |
ae9fec7ac1937b3bf7da2ba34230db26039ba5e422aa5fc7052dee711672172a
|
Provenance
The following attestation bundles were made for obscure-1.0.4-py3-none-any.whl:
Publisher:
publish.yml on jidn/obscure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
obscure-1.0.4-py3-none-any.whl -
Subject digest:
6350f43baae9fd26c4b2d8d8180e4bd6c20d5c6fb9986fe79282c25dbb716f16 - Sigstore transparency entry: 761936109
- Sigstore integration time:
-
Permalink:
jidn/obscure@cb78445a1506ef05cfe2e8620c757e3155677de7 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/jidn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cb78445a1506ef05cfe2e8620c757e3155677de7 -
Trigger Event:
release
-
Statement type: