Skip to main content

Create reversible transformations to obscure sequential ID numbers.

Project description

build status version license coverage downloads

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obscure-1.0.4.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obscure-1.0.4-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

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

Hashes for obscure-1.0.4.tar.gz
Algorithm Hash digest
SHA256 cbbc72bab6b01ea52d74f69142cf135ca054f6631d6153ee8091b56d73fb6366
MD5 e48073d651723bbc331cc730d9471e4d
BLAKE2b-256 fa4f86fc355d96d4badf268063a18217ca821caf4ae1108ed64000f5fb18e826

See more details on using hashes here.

Provenance

The following attestation bundles were made for obscure-1.0.4.tar.gz:

Publisher: publish.yml on jidn/obscure

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for obscure-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6350f43baae9fd26c4b2d8d8180e4bd6c20d5c6fb9986fe79282c25dbb716f16
MD5 3fb01d6fc55cb4c15800af7e71ac6c5b
BLAKE2b-256 ae9fec7ac1937b3bf7da2ba34230db26039ba5e422aa5fc7052dee711672172a

See more details on using hashes here.

Provenance

The following attestation bundles were made for obscure-1.0.4-py3-none-any.whl:

Publisher: publish.yml on jidn/obscure

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page