In your favorite language (preferable in Python) create the following functions:MRT => Use Miller-Rabin Primality Test to choose a prime number with s=512 bits and check the primality test.EA => Use...



In your favorite language (preferable in Python) create the following functions:





  1. MRT

    =>

    Use Miller-Rabin Primality Test to choose a prime number with s=512 bits and check the primality test.





  2. EA


    =>

    Use Euclidean Algorithm to evaluate gcd





  3. EEA


    =>

    Use Extended Euclidean Algorithm to find modular inverse of the value





  4. powmod_sm

    =>

    Square and multiply algorithm to evaluate exponentiation.





Now write the code for





  1. RSA Key Generation (use above functions 1., 2., 3. ) should be






    1. Choose two primes

      p

      and

      q

      of

      s

      bits using

      MRT

      where

      p

      is not equal to

      q
      .





    2. Calculate

      n=p*q
      , and

      ϕ(n) = (p-1)*(q-1)





    3. Chose randomly e from the set of {1,…,

      ϕ

      n
      -1
      } and check using EA if

      gcd(e, ϕ(n))=1

      if not chosen again until it fulfills the condition.





    4. Calculate

      d=
      e
      -1

      mod ϕ(n)


      using EEA. Note that

      d

      should be at least

      0.3*s

      bits





    5. Output

      k
      Pub
      =(n,e)

      and

      k
      Pr

      = (d)






  2. RSA Encryption with input

    k
    Pub
    =(n,e)

    and random plaintext

    x

    and output should be ciphertext

    y
    , evaluate exponentiation using the function

    powmod_sm





  3. RSA Decryption with input

    k
    Pr

    = (d)


    and ciphertext

    y

    and output should be plaintext

    x
    , evaluate exponentiation using the function

    powmod_sm
    . Please make sure to check that you get the same plaintext value before the encryption.







Please write your report and include a snapshot of output with you source code.

Apr 09, 2023
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here