1
$\begingroup$

I have coded a Python program. Here's the example of my inputs and outputs:

|Input        |Output          |
|-------------|----------------|
|wcf4#        |'gpiyR'         |
|rekvof       |"l`'-l\x08"     |
|Hello!       |'Q`c\\l&'       |
|qwerty       |"d.e\n='"       |
|qwaszx       |'d.0vlg'        |
|1234567890   |'26=ydc5u\n8'   |
|'26=ydc5u\n8'|'[6p9r6dn6cd2i' |
|ErRROr 404   |'J3U\nLpvl/b'   |
|1R4^hg}\?~~~ |'2#wDny$\nF~~~' |
|pythonpython |'.9[=l9\n\\;6up'|

How does this program work? You can use a computer and your programming knowledge to find this out.

Somehow you can figure this out with no computer, but that takes a long time.

Python (or JS) code for analysis:

{"wcf4#": 'gpiyR', "rekvof": "l`'-l\x08", "Hello!": 'Q`c\\l&', "qwerty": "d.e\n='", "qwaszx": 'd.0vlg', "1234567890": '26=ydc5u\n8', "'26=ydc5u\\n8'": '[6p9r6dn6cd2i', "ErRROr 404": 'J3U\nLpvl/b', "1R4^hg}?~~~": '2#wDny$\nF~~~', "pythonpython": '.9[=l9\n\;6up'}
$\endgroup$
1
  • $\begingroup$ You don't need to mention the edit summary in the question , people might mistake it for a clue or a hint , its better if you include edit summaries in the edit summary section down below $\endgroup$ Dec 17, 2021 at 9:16

1 Answer 1

1
$\begingroup$

I think:

Each character is encoded based on it's position in the string, and it's position on a standard(ish) US computer keyboard.
I got this mostly from examining the output from "1234567890", the various 4's, and the fact that ~ always encodes to itself.

Explanation:

Starting with "`" and counting along the rows of the keyboard, assign each key a number. (Including Return, Backspace and Tab but ignoring all other meta keys (Shift, Ctrl, Alt etc.) )
(So "`" is 0, "1" is 1, Backspace is 13, Tab is 14, "p" is 24 etc.)

Then, for each input character, shift it forwards by its position on the keyboard multiplied its position in the input string.
E.g. For wcf4#

Plaintext  Index Keyboard    Shift    Encoded             Encoded
                 Position             Key Pos             Key
 w         1     16          1*16=16  32                  g
 c         2     42          2*42=84  126 (mod 51 = 24)   p
 f         3     31          3*31=93  124 (mod 51 = 22)   i
 4         4     4           4*4=16   20                  y
 #         5     3(shifted)  5*3=15   18                  R (still shifted)

Other minor things to note:
- "~" is in position 0, so always encodes to itself
- Shift is sticky, so capitals and shifted punctuation remain capitals or shifted punctuation (like the # above becoming R)

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.