Cipher dict Cipher dict
Undefined
English
The mission is in Blocked Mode. Access to the solutions is blocked for a day or two (even after you share your own), until we'll have enough solutions for you to check. All users who've solved the mission will get the notifications about their opening.

In this mission, you have to convert a plain text to a cipher dictionary according to the next rules.

  1. Encode the plain text with utf-8.
  2. Take this value as a single hexadecimal number and convert it to a decimal number.
  3. Make a empty dictionary A.
  4. Add a data(key = value of each digit of decimal number, value = empty dictionary) to the appropriate dictionary.
    1. Initial dictionary is A
    2. 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.
    3. 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.