This is a Pure-Python implementation of RFC 1751.
Using this small library, you can turn binary strings (for example IDs or passwords) into small sequences of short English words. For example:
EB33 F77E E73D 4053
would become:
TIDE ITCH SLOW REIN RULE MOT
The algorithm turns a 64-bit string into 6 English words and vice versa. Two bits of parity are included in the sequence of words, which allow detecting an invalid or corrupted phrase.
Usage
>>> # Simple conversion from string or bytes
>>> rfc1751.bytes_to_string([204, 172, 42, 237, 89, 16, 86, 190])
'RASH BUSH MILK LOOK BAD BRIM'
>>> rfc1751.bytes_to_string(b'\xCC\xAC\x2A\xED\x59\x10\x56\xBE')
'RASH BUSH MILK LOOK BAD BRIM'
>>> # You can specify the separator or get a sequence
>>> rfc1751.bytes_to_string(b'\xCC\xAC\x2A\xED\x59\x10\x56\xBE', sep='-').lower()
'rash-bush-milk-look-bad-brim'
>>> rfc1751.bytes_to_words(b'\xCC\xAC\x2A\xED\x59\x10\x56\xBE')
['RASH', 'BUSH', 'MILK', 'LOOK', 'BAD', 'BRIM']
>>> # Conversion back
>>> rfc1751.string_to_bytes('RASH BUSH MILK LOOK BAD BRIM')
b'\xCC\xAC\x2A\xED\x59\x10\x56\xBE'
>>> list(rfc1751.string_to_bytes('RASH BUSH MILK LOOK BAD BRIM'))
[204, 172, 42, 237, 89, 16, 86, 190]
>>> # You can specify the separator or give a sequence
>>> rfc1751.string_to_bytes('rash-bush-milk-look-bad-brim', sep='-')
b'\xCC\xAC\x2A\xED\x59\x10\x56\xBE'
>>> rfc1751.words_to_bytes(['rash', 'bush', 'milk', 'look', 'bad', 'brim'])
b'\xCC\xAC\x2A\xED\x59\x10\x56\xBE'
>>> # You can also use a custom alphabet as long as it is 2048 words
>>> custom_rfc1751 = rfc1751.Rfc1751(custom_2048_words)
>>> custom_rfc1751.bytes_to_string([204, 172, 42, 237, 89, 16, 86, 190])
'SMILE GENUINE ROBUST RATE AIR GAME'
>>> list(custom_rfc1751.string_to_bytes('SMILE GENUINE ROBUST RATE AIR GAME'))
[204, 172, 42, 237, 89, 16, 86, 190]
Metadata
Release files for rfc1751 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rfc1751-1.0.0.tar.gz | 8.8 kB | Without provenance | Details for rfc1751-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rfc1751-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for rfc1751-1.0.0-py3-none-any.whl |
Total release size: 17.7 kB
Release files / rfc1751-1.0.0.tar.gz
| Download URL | rfc1751-1.0.0.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
448e017ea19fd8f006b3dc88279dd65a62dfea78874f6eb16a7249fabc771ce8
|
|
BLAKE2b-256 checksum How to use checksums |
a8b334f058605134993f6886418120a2ce64f25ff4e35a3f2879872be124f974
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / rfc1751-1.0.0-py3-none-any.whl
| Download URL | rfc1751-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3541bb8db86e7b55a8d467572330bcd1a0d3558a0413dccafa23ad4bed22b7a2
|
|
BLAKE2b-256 checksum How to use checksums |
00ebed2daece2b2f0dead3f05127a387540fb628d5048c02c4ca70fb6c65fa46
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for rfc1751 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.