In C++ or C ONLY PLEASE 1.thefunctionsforRSA: (a)Mappingfunction from todecimald
ID: 3940788 • Letter: I
Question
In C++ or C ONLY PLEASE
1.thefunctionsforRSA:
(a)Mappingfunction from todecimaldigits(SeetextbFigure9.7.(b)andformapping).willtoausedinRSAencryptionanddecryption.
(b)Keythattheinputsofprimeand,andgeneratetheparameters(n, ?(n), e, d),andtheforRSA.Thesub-routines
GCD function to find e: gcd(?(n), e) = 1; 1 < e < ?(n). Since there could be many such e values, you may use gcd to find the first five such e values.
Multiplicative inverse: d = e?1(mod ?(n)). You may use extended Euclidean algorithm to find the first five such d values corresponding to each of five e values (Note: Your multiplicative inverse value should be within [0, ?(n))).
(c)Encryptionfunctionthatofandpublic
(d)functionthatofciphertextand
(e)functionfromdecimaldigitsto
2.Experimentthecorrectnessofprogramusingtheplaintextandprimep =73andq =151:
(a)text:
(b)plaintext:
For each test of your RSA algorithm, you need to output the following information:
(a)RSAinformation:n, ?(n),thefirste,andd
(b)plaintext
(c)setsof:
Public key
Ciphertext
Private key
Plaintext
(d)fromdecimaldigitstoTheoutputfortheinputofisinFigure1.