I am trying to learn how RSA cryptography work. I think I have figured out everything, except getting back the characters I started with.
For example, lets say I have a base of 26 (Eng alphabet) and sections of 4 characters at a time. I have a string "ABCD" I want to encrypt. What I do is assign each character to a number, starting from 0. So $$"ABCD" \implies (0,1,2,3)$$ After that I add the base $$0*26^{0}+1*26^{1}+2*26^{2}+3*26^{3} \implies 54106 := M$$ So $M$ is my unencrypted string. Lets just stop here, lets say I cryptate it and send it over to a buddy, he decrypts it and end up with $54106$, how should he go from there?
I have to end up with $0*26^{0}+1*26^{1}+2*26^{2}+3*26^{3}$ again so I can pick out the letters otherwise it makes no sense. Anyone who know?
This is only remotely related to RSA or cryptography. What you want is just a base conversion between base 10 and base 26. You have already done the direction $10\rightarrow 26$. The inverse is a repeated application of the Euclidian division:
Suppose you want to convert the number $n$ to base $B.$ Then perform
$$q_{k+1} = \lfloor q_k / B\rfloor, \;r_{k+1} = q_k \bmod B$$
with $q_0 = n$ until a $q_k$ becomes zero. The base-B representation is the reverse concatenation of the remainders. For you example
So $59106_{10} = 3210_{26} = 3\cdot 26^3 + 2\cdot 26^2 + 1\cdot 26^1 + 0\cdot 26^0$
For more info see e.g. https://en.wikipedia.org/wiki/Positional_number_system#Base_conversion