Skip to main content

pypricklybird

PyPI - Version PyPI - Python Version Ruff GitHub License


Overview

pricklybird is a method for conversion of arbitrary binary data into more human-friendly words,
where each word represents a single byte.
A CRC-8 checksum is attached to allow the detection of errors during decoding.
0xDEADBEEF becomes turf-port-rust-warn-void, for example.

pypricklybird is a python implementation of pricklybird version v1.

Documentation

Documentation is generated using pdoc and can be found here.

Usage

Basic conversion functions that fully comply with the specification and include the CRC can be used as follows.

>>> from pypricklybird import convert_to_pricklybird, convert_from_pricklybird
>>> data = bytearray.fromhex("4243")
>>> code = convert_to_pricklybird(data);
>>> code # Notice the third word "full" used to encode the CRC.
'flea-flux-full'
>>> convert_from_pricklybird(code).hex()
'4243'

It is also possible to map word to bytes and bytes to words without the full standard implementation and CRC.

>>> from pypricklybird import words_to_bytes, bytes_to_words
>>> data = bytearray.fromhex("4243")
>>> words = bytes_to_words(data)
>>> words # Notice that no CRC is attached
['flea', 'flux']
>>> words_to_bytes(words).hex()
'4243'

Direct access to the WORDLIST used for mapping bytes to words, and the HASH_TABLE use to map words to bytes is also possible.

>>> from pypricklybird import WORDLIST, HASH_TABLE, word_hash
>>> # Confirm that the word flux maps to the byte 0x43 in both directions.
>>> word = "flux"
>>> table_index = word_hash(word[0], word[-1]);
>>> table_index
603
>>> byte_value = HASH_TABLE[table_index]
>>> hex(byte_value)
'0x43'

Installation

pip install pypricklybird

License

pypricklybird is distributed under the terms of the MIT license.

Metadata

Release files for pypricklybird 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypricklybird 1.0.3
File Size Uploaded
pypricklybird-1.0.3.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pypricklybird 1.0.3
File Interpreter ABI Platform
pypricklybird-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / pypricklybird-1.0.3.tar.gz

Download URL pypricklybird-1.0.3.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6c41a1bb0c16025d0672f1c82cbfda561a812db9178620bc2e3613dd45e8aac2
BLAKE2b-256 checksum
How to use checksums
7fb7b3a5f4352f4d755cef10e726e30fd978cde7645eae354ee57672d704499d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pypricklybird-1.0.3-py3-none-any.whl

Download URL pypricklybird-1.0.3-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
812505f0f77a991ceb5140495794eb4b1f8a7247dee7ef57aee1a799b0387c38
BLAKE2b-256 checksum
How to use checksums
2542adce78ffb8953a016c50fb72601254ca358b1fb5ec36fb2f69e186661e0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page