Skip to main content

Embedded messages in text for Python.

Project description

This library includes a set of tools for using zero-width unicode characters to embed human-invisible messages in text.


You can use invisible ink to uniquely identify a piece of text by embedding a UUID:

>>> from invisible_ink import encode_watermark, decode_watermark
>>> encoded_text, uuid = encode_watermark(u'asdf')
>>> print encoded_text
>>> uuid
>>> decode_watermark(encoded_text)
(u'asdf', UUID('3ca37a37-9c5a-4b9e-a9c0-a50c47c48dba'))

encode_watermark (text, watermark_uuid=None, prepend=False)

Encodes the given text with a watermark string generated from the given uuid. Optionally appends or prepends the watermark string.


  • text: Unicode string to which the watermark will be added
  • watermark_uuid: uuid.UUID instance to use as the watermark. (uuid.uuid4() will be used to generate one if not provided.)
  • prepend: Indicates whether the watermark should be prended to text (defaults to False). If False, the watermark will be appended.


A 2-tuple: (encoded_text, watermark_uuid)

decode_watermark (encoded_text)

Decodes the given text, separating out the original text and the watermark uuid.


  • encoded_text: Unicode string which potentially includes a watermark


A 2-tuple: (text, watermark_uuid). If no watermark is detected, text is the original text and watermark_uuid is None.


$ pip install invisible-ink

Project details

Download files

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

Files for invisible-ink, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size invisible_ink-0.1.1-py2.py3-none-any.whl (4.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size invisible-ink-0.1.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page