
Cipher dict
In this mission, you have to convert a plain text to a cipher dictionary according to the next rules.
- Encode the plain text with utf-8.
- Take this value as a single hexadecimal number and convert it to a decimal number.
- Make a empty dictionary A.
- Add a data(key = value of each digit of decimal number, value = empty dictionary) to the appropriate dictionary.
- Initial dictionary is A
- Change to a dictionary that was created earlier at the timing when the ascending order and descending order of the value of each digit of the decimal number are switched. (Change even if the same value continues.) Store from the upper digit. And find the ascending part first. ex.) decimal number == 1248854369653 → 1248 / 8543 / 69 / 653
- Change at the timing /.
Input: A plain text as a string.
Output: A cipher data as a dict.
Example:
get_cipher("hello") == {4: {4: {8: {3: {7: {0: {4: {}, 7: {}}, 2: {2: {}}}, 8: {3: {}}}}}}} get_cipher("This is a plain text.") == {1: {3: {2: {1: {4: {7: {4: {1: {0: {}, 2: {}, 7: {}}, 4: {9: {}}, 8: {3: {}}}, 6: {8: {1: {}, 4: {}, 9: {}}}}}, 9: {5: {5: {6: {1: {}, 4: {}}, 8: {}}}}}}}}, 2: {6: {2: {8: {4: {9: {5: {2: {}, 8: {}}}}}}}}, 3: {2: {4: {1: {4: {8: {3: {0: {}, 2: {}}}}}, 3: {5: {3: {5: {4: {}, 7: {}}}}}}}}}
How it’s used: (It may not be valuable as a cipher, but it will be useful for studying character code conversion and dictionary structure.)
Precondition: The text contain only ASCII symbols.
CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.
In order to install CheckiO client you'll need installed Python (version at least 3.8)
Install CheckiO Client first:
pip3 install checkio_client
Configure your tool
checkio --domain=py config --key=
Sync solutions into your local folder
checkio sync
(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)
checkio serv -d
Alternatevly, you can install Chrome extension or FF addon
checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium
Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.