Skip to content

Commit

Permalink
Fix syntax highlighting in README
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Apr 24, 2024
1 parent 4f7f336 commit 25bb02e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@ The algorithm turns a 64-bit string into 6 English words and vice versa. Two bit

# Usage

```python
```pycon
>>> # 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
>>> # 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
>>> # 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
>>> # 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
>>> # 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'
Expand Down

0 comments on commit 25bb02e

Please sign in to comment.