Question
1 Background 1.1 modpower To calculate the value for 2 3 mod 3 we can use the modpower function. We know that, 2 3 mod
1 Background 1.1 modpower To calculate the value for 2 3 mod 3 we can use the modpower function. We know that, 2 3 mod 3 = 8 mod 3 = 2 Heres the R code to do that library(numbers) modpower(2, 3, 3) ## [1] 2 1.2 coprime To find whether two numbers are relative prime or co-prime, we can use the coprime function in R (numbers package). For example. coprime(20, 3) ## [1] TRUE?
Please write your code in the given .Rmd file and submit your script.
Question 3. Encrypt the following message with the encryption function from question 1: Attack at 1300 hours. (20 points). p and q are random primer numbers (use Primes() fuction from numbers package). Choose p from a range [150, 170] and q from range [290, 350] Calculate N and phi from p and q (follow the steps shown in last Wednesdays class lecture) Take another prime e such that e and phi are co-prime Calculate d as the inverse mode between e and phi You need to set these values only once outside the encrypt and decrypt functions?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started