Skip to main content

Weird text encoder / decoder. Gives reversible, human-readable and lossless encoding.

Project description

PyPI version pipeline status coverage report PyPI pyversion PyPI license PyPI status

DIZZER

Bidirectional human-readable weird-text encoder/decoder.

For each original word in the original text, it leaves the first and last character of it in that position, but shuffles (permutates) all the characters in the middle of the word. If possible, the resulting “encoded” word is different than the original word.

Words shorter than 4 characters or with double letters inside - like: "keep", "seen", "moon" cannot be scrambled - because swapping its characters has no effect.

Key features:

  • simple, straight-forward
  • 100% translatable - back and fourth
  • codec is lossless and doesn't need any additional data for translation
  • scrambles all numbers and slugs as well
  • keeps other non-word text parts unchanged

Scrambling order is pseudo-random and different for each word.

Usage

import dizzer

original_text = """
Text can contain unlimited number of whitespaces, newlines etc.
Numbers like 12345, 1234567, 987654321 or 123456789 are also scrambled.
"""
encoded = dizzer.encode(original_text)

print(encoded)

# Txet can cnitaon umnitelid nmeubr of wtsehaecips, newniels etc.
# Numbres lkie 14325, 1346257, 967843251 or 143267859 are aslo scrmeabld.

# reverse operation:
decoded = dizzer.decode(encoded)

print(decoded)

# Text can contain unlimited number of whitespaces, newlines etc.
# Numbers like 12345, 1234567, 987654321 or 123456789 are also scrambled. 

Installation

pip install dizzer

It has no dependencies and works in python 3.7, 3.8, 3.9 and pypy3.

Interoperability check

There is non-zero probability, that the algorithm works different on sophisticated environments (i.e. when your python interpreter uses weird pseudo-random generator library).

At import time of dizzer package there is a self-check statement. It checks if this algorithm works in your environment. There is a snippet that raises an import error if a malfunction is detected. In other words - if you are able to import dizzer - you can be sure, that your encoded text can be decoded on othr machines.

The self-check statement

import dizzer


PROPER_TEXT = """
This sentence approves that dizzer can be used on your machine.
If this assertion is not raised - it means you can read and write messages
that are fully translatable on other machines.
"""

EXPECTED_ENCODING = """
Tihs senectne aepvorps taht dzzier can be uesd on yuor mhcaine.
If tihs aosirtsen is not risaed - it mneas you can raed and wtrie msesgeas
taht are fluly tbnslalatrae on oethr mhacneis.
"""

local_encoding = dizzer.encode(PROPER_TEXT)
back = dizzer.decode(local_encoding)

assert local_encoding == EXPECTED_ENCODING, "Failed to encode."
assert back == PROPER_TEXT, "Failed to decode."

Download files

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

Source Distribution

dizzer-0.1.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

dizzer-0.1.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file dizzer-0.1.2.tar.gz.

File metadata

  • Download URL: dizzer-0.1.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for dizzer-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0d2d6d48793b237df08b8e36f3639304669e492567ffb08be91947a4f63f7c24
MD5 4dfab331616f7fa63d2a619cfad74079
BLAKE2b-256 a53086153e498e74090b7ce19e67d2c79c990cbd22428a9ac45e0e88496c797b

See more details on using hashes here.

File details

Details for the file dizzer-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dizzer-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for dizzer-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1927b950f5ad17adcb35d4e46fced1ada37d4c7bcf40ad7c5ca5b609c973afba
MD5 617f69adc88766129f92ae15cfe2ccbd
BLAKE2b-256 64daf358ef649b480b53af1ac01272aed84ba326584c16136c7d12bf8519daa4

See more details on using hashes here.

Supported by

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