Intro
I got a string original
, which was encoded (using the procedure below), then encrypted with rsa and then decoded again, so I'm left with a ciphertext s
.
To get back to the original
plaintext I'd encode s
, then decrypt and then decode again.
Encoding
Each character in s
gets encoded (using the function x
) like this:
x(A)=0, x(B)=1, ..., x(Z)=25
Then the message, with k
amount of characters, gets encoded (using the function y
) like this:
encoded_msg = y(s) = x(s0)*260 + x(s1)*261 + x(s2)*262 + ... x(sk)*26k-1
The problem
Now, if i do this for original="ABCD"
for example, that would lead to
y(x(original)) = 0 + 1*26 + 2*676 + 3*17576 = 54106
.
(encrypt → decrypt → 54106
)
decode ?
My question is: If all I got are the functions x
and y
and a result 54106
, how do I decode back to "ABCD"
?