[Solved] implantation of RSA algorithm in c++ [closed]


Not sure I get your question right but my bet is you’re asking how to convert between ASCII and number representation of characters.

Encoding/Decoding has nothing to do with RSA. You just use dynamic range shift. As the alphabet is in increasing order in ASCII so the only thing left is to offset the a or A to zero.

for lowercase char to number conversion try:

char c="m";  // c is you character m for example
int i=c-`a`; // i is output number 

if you got both lowercase and uppercase letters then you need to change it to :

char c="q";  // c is you character q for example
int i;       // i is output number 
if ((c>='a')&&(c<='z')) i=c-'a';
 else                   i=c-'A';`

where c is your character and i is output number

For number to char conversion try:

c=i+`a`;

or for uppercase:

c=i+`A`;

solved implantation of RSA algorithm in c++ [closed]