Skip to main content

Fast and efficient coding of binary data into non-breaking unicode whitespace

Project description

invisicode

Encodes arbitrary byte-strings into strings that display invisibly on devices and platforms supporting unicode.

Operates in base 4096 with one additional padding character for specific input widths, meaning 1.5 bytes per character on average.

Originally a coding scheme designed for github.com/thomas-xin/Miza, as one of the methods to hide small amounts of persistent data in text messages to reduce visual clutter.

Usage

encode(
    b: str | bytes | bytearray | memoryview | numpy.ndarray,
    padding: int = 119162
) -> str
decode(s: str, padding: int = 119162) -> bytes
import invisicode
data = b"Hello World!"
encoded = invisicode.encode(data) # '\U000e0548\U000e06c6\U000e0f6c\U000e0206\U000e0f57\U000e0726\U000e046c\U000e0216'
assert invisicode.decode(encoded) == data # b"Hello World!"
import invisicode
data = "Hello World! ❤️"
encoded = invisicode.encode(data) # '\U000e0548\U000e06c6\U000e0f6c\U000e0206\U000e0f57\U000e0726\U000e046c\U000e0216\U000e0220\U000e09de\U000e0fa4\U000e0b8e\U000e008f'
assert invisicode.decode(encoded) == data.encode("utf-8") # b'Hello World! \xe2\x9d\xa4\xef\xb8\x8f'
import invisicode
import numpy as np
data = np.random.randint(0, 256, size=10 ** 8, dtype=np.uint8)
encoded = invisicode.encode(data) # '\U000e05b7\U000e0504\U000e02cc\U000e09a9\U000e0df5\U000e0066\U000e0d96󠅋\U000e0959\U000e0469...
assert invisicode.decode(encoded) == data.tobytes()

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

invisicode-1.0.2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

invisicode-1.0.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file invisicode-1.0.2.tar.gz.

File metadata

  • Download URL: invisicode-1.0.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.8

File hashes

Hashes for invisicode-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b1c74562043934cf79749cd857e128192792aee1d1e4bba3fc0011a7904af95c
MD5 d8b24722dfb00ae1d13b19b2e9447c36
BLAKE2b-256 46d5b2ec99eefd7387bd6a1c62dfd81d7a55573d61ba63fc33e41eca9bf4887f

See more details on using hashes here.

File details

Details for the file invisicode-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: invisicode-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.8

File hashes

Hashes for invisicode-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c9400195b6e36ed557bab52ef387bda0084dbf6218869fc2cca1686c598b1db1
MD5 b38a9ccce2d37418d9e79e89241e51f3
BLAKE2b-256 44551c42bad64b645de31a02422bc430190909df032171c604cccce04457b39b

See more details on using hashes here.

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