Skip to content

Commit

Permalink
EncodeDecode
Browse files Browse the repository at this point in the history
Combined all the encoding and decoding functions into a class
Added better explanations for what a function does.
Renamed some functions and variables for better readability.
Added error-handling for when a file is not found.
Added a way to switch layout while decoding.
  • Loading branch information
5mikachu committed Aug 7, 2024
1 parent 59c4903 commit 55dff3e
Show file tree
Hide file tree
Showing 4 changed files with 243 additions and 167 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

/__pycache__
/.vscode
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,27 @@ This Python program allows you to 'encode' and 'decode' text using various keybo
* **Encoding and Decoding**: Converts text to encoded format and vice versa.
* **File Handling**: Can 'encode' and 'decode' text from files.
* **Interactive Menu**: Both a GUI and console based interface.
* **Layout Switching**: It is possible to switch layout (when decoding).

# Examples

_Unless stated otherwise, QWERTY was used._

## Encode and Decode

**in**: The quick brown fox jumps over the lazy dog.!?
**out**: 12x05 03x06 02x03 00x00 02x01 02x07 02x08 04x03 03x08 00x00 04x05 02x04 02x09 02x02 04x06 00x00 03x04 02x09 04x02 00x00 03x07 02x07 04x07 02x10 03x02 00x00 02x09 04x04 02x03 02x04 00x00 02x05 03x06 02x03 00x00 03x09 03x01 04x01 02x06 00x00 03x03 02x09 03x05 04x09 11x02 14x10

**in**: 04x06 02x03 00x02 02x03 04x08 00x00 02x03 04x06 02x05 02x04 02x03 02x10 02x09 00x03 02x05 04x08 00x00 14x01 02x09 02x03 00x09 04x08 00x00 03x04 03x01 04x03 00x13 03x01 03x03 02x03 04x08 00x00 13x02 02x03 04x06 00x04 02x09 02x04 04x08 00x00 03x06 03x01 00x02 04x03 00x0D 02x03 03x08
**in**: 04x06 02x03 00x02 02x03 04x08 00x00 02x03 04x06 02x05 02x04 02x03 02x10 02x09 00x03 02x05 04x08 00x00 14x01 02x09 02x03 00x09 04x08 00x00 03x04 03x01 04x03 00x13 03x01 03x03 02x03 04x08 00x00 13x02 02x03 04x06 00x04 02x09 02x04 04x08 00x00 03x06 03x01 00x02 04x03 00x0D 02x03 03x08
**out**: née, entrepôt, Zoë, façade, Señor, háček

## Switching layout

**NOT YET POSSIBLE WHEN ENCODING**

**in**: 13x03 02x08 03x03 00x00 02x06 02x09 02x07 00x00 03x08 04x06 02x09 02x02 00x00 ru 00x00 02x01 02x02 02x03 02x04 02x05 02x06 00x00 qy 00x00 02x08 03x02 00x00 04x06 02x09 02x05 00x00 03x01 00x00 02x02 02x09 02x04 03x03 14x10
**out**: Did you know ~ru~ йцукен ~qy~ is not a word?

# Requirements

* Python 3.x
Expand Down Expand Up @@ -104,9 +114,9 @@ layouts = {
'gr': (greek_lowercase, greek_uppercase),
'he': (hebrew_lowercase, hebrew_uppercase),
'hr': (hcesar_lowercase, hcesar_uppercase),
'jn': (jcuken_lowercase, jcuken_uppercase),
'qy': (qwerty_lowercase, qwerty_uppercase),
'qz': (qwertz_lowercase, qwertz_uppercase),
'ru': (cyrillic_lowercase, cyrillic_uppercase),
'wn': (workman_lowercase, workman_uppercase)
}
```
Expand All @@ -126,14 +136,11 @@ encode_special_mappings = {
' ': '00x00', # SPACE
'\n': '10x00', # Newline
'\t': '10x01', # Tab
'\\': '10x02', # Backslash
'\'': '10x03', # Single quote
'\"': '10x04', # Double quote
'\r': '10x05', # Carriage return
'\b': '10x06', # Backspace
'\f': '10x07', # Form feed
'\v': '10x08', # Vertical tab
'\a': '10x09', # Bell/alert
'\r': '10x02', # Carriage return
'\b': '10x03', # Backspace
'\f': '10x04', # Form feed
'\v': '10x05', # Vertical tab
'\a': '10x06', # Bell/alert
'̀': '00x01', # Grave accent
'́': '00x02', # Acute accent
'̂': '00x03', # Circumflex
Expand Down
Loading

0 comments on commit 55dff3e

Please sign in to comment.