Semantron 21 Summer 2021

Cryptography

example, the ISP, Wi-Fi points and other computers are making and storing copies of the message each time they are passed through. The recipient sends the sender their public key file over an insecure channel so the sender can encrypt their message using the public key. The sender can now send the message to the intended recipient who can then decrypt the message using their private key which differs from the public key. This means that the message is only encrypted to the recipient of the message and it cannot be decrypted if it’s intercepted. The advantage of asymmetric encryption is that there is no need to exchange keys thus making it more secure. However, it is significantly slower than other methods.

RSA encryption

RSA (Rivest-Shamir-Adleman) encryption is a public key encryption method which is regarded as the most secure method of encryption. RSA encodes a message M by computing Cipher text ( Ct ) = M e mod N , where N = pq is the product of two large primes and e is a random large number, restricted by the requirement 1 < e < Ф(n) such that Ф(n) = ( p – 1)( q – 1). The decoding computation requires a number d that satisfies ed = 1 mod ( p – 1)( q – 1), and Euler’s general ization of Fermat’s Little Theorem guarantees M = C d mod N . If M is less than N , the computation returns it intact. The plain text needs to be converted to numbers, for example, ‘ HI ’ would be 89, and thus the encrypted data ( C ) = 89 e mod N, which will provide an integer. The security of RSA is dependent on the difficulty of factoring numbers which are large primes. If the key size is increased, e.g. doubled or tripled, then the strength increases exponentially. The question asked is, is the computational power of quantum computers powerful enough to crack an RSA encoded message?

RSA Algorithm #import necessary libraries from decimal import Decimal

def gcd(a,b): if b==0: return a else:

return gcd(b,a%b)

#end if #end function

#take inputs for prime factors & text p = int(input('Enter the value of p = ')) q = int(input('Enter the value of q = ')) no = int(input('Enter the value of text = '))

#calc n & t (t = O(n) above) n = p*q t = (p-1)*(q-1)

for e in range(2,t):

182

Made with FlippingBook Digital Publishing Software