You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Characters (organized as capital, lowercase, special, phrases)
Capital (26) : A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
Will always start with 11
Lowercase (18): b, c, d, f, g, j, k, l, m, p, q, r, u, v, w, x, y, z
Will always start with 10
Phrases (12): th er an on and the to you of be in
Will always start with 11
Note the spaces around some phrases indicated by highlights
Special (8): . , - ! ' " \n
Can start with either 10 or 11 (uses remaining bits)
indicated as a highlighted space
Excluding the first character (always 1, used to indicate long char) and the second character (used to indicate capital, lowercase, phrase, or special char), long characters follow a standard pattern going down the list of 0000, 0001, 0010, 0011, 0100, etc.
Short Characters
3 bits total (23 = 8)
Starts with 0
Characters:
e, t, a, i, o, n, s, h
Excluding the first character (always 0, used to indicate short char), Short characters follow a standard pattern going down the list by 0000, 0001, 0010, 0011, 0100, etc.
How it works
Ensure binary_code.json is in the same folder as the encode/decode file you are running.
If binary_code.json is invalid or missing, code will print "binary_code.json invalid or missing. Is it in the same folder?"
When running either files, both will ask you to input a file to convert to binary or text. Make sure that that file is in the same folder as the encode/decode file, and enter the full filename (e.g. “test.txt”).
If a file name is invalid, the code will print “File invalid.” and exit.
Encode.py will convert all the text in the file (assuming each character is in our binary code) to binary. Decode.py will be able to convert that binary code back.
If a character is not in our binary code, encode.py will simply skip it. If decode.py receives an invalid binary code or an invalid character, it will just put it into the result without changing it.
After encode.py and decode.py prints their converted results, the data is saved into their files encode_output.txt and decode_output.txt, respectively.
If any output files are missing, the code will create its output file and properly save the data onto it.