Question

Computing RSA by hand. Let p = 13, q = 23, e = 17

0 0
Add a comment Improve this question Transcribed image text
Answer #1

class StringSet
{
//An instance variable of type String[]
String[] set;
//An int instance variable that indicates the number of String objects that the StringSet currently contains.
int numOfStrings;
//A no argument constructor.
public StringSet()
{
numOfStrings = 0;
set = new String[10];
}
//A mutator that adds a String newStr to the StringSet object.
void add(String newStr)
{
set[numOfStrings++] = newStr;
}
//An accessor that returns the number of String objects that have been added to this StringSet object.
int size()
{
return numOfStrings;
}
//An accessor that returns the total number of characters in all of the Strings that have been added to this StringSet object.
int numChars()
{
int sum = 0;
for(int i = 0; i < numOfStrings; i++)
sum += set[i].length();
return sum;
}
//An accessor that returns the number of Strings in the StringSet object that have exactly len characters.
int countStrings(int len)
{
int count = 0;
for(int i = 0; i < numOfStrings; i++)
if(set[i].length() == len)
count++;
return count;
}
}

And the code for StringSetTester.java is:

import java.util.*;
class StringSetTester
{
public static void main(String[] args)
{
Scanner kybd = new Scanner(System.in);
System.out.print("How many strings will you enter? ");
int numStr = kybd.nextInt();
kybd.nextLine();
StringSet ss = new StringSet();
for(int i = 0; i < numStr; i++)
{
System.out.print("Enter string " + (i+1) + ": ");
String temp = kybd.nextLine();
ss.add(temp);
}
System.out.println("The size of the StringSet is: " + ss.size());
System.out.println("The number of characters in StringSet is: " + ss.numChars());
System.out.println("The number of strings of length 5 are: " + ss.countStrings(5));
System.out.println("The number of strings of length 7 are: " + ss.countStrings(7));
}
}

Add a comment
Know the answer?
Add Answer to:
Computing RSA by hand. Let p = 13, q = 23, e = 17 be your...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • O-8. (15 points) Bob's simple toy RSA eryptosystem has public key kyub(n, e) (65,5), where n =p,-...

    o-8. (15 points) Bob's simple toy RSA eryptosystem has public key kyub(n, e) (65,5), where n =p,-5x13-65 and e-5. I. Describe the key pair generation procedure for Bob to generate his private key kor- d. With the above given parameters, use EEA to calculate d 2. Describe RSA encryption procedure that Alice uses to encrypt her plaintext message x to its above given parameters, what will be y? ciphertext y before sending the message to Bob. Suppose Alice's message x-...

  • please help me to solve (c and d) knowing that d=209 Let the two primes p...

    please help me to solve (c and d) knowing that d=209 Let the two primes p = 41 and q = 17 be given as set-up parameters for RSA. a. Which of the parameters e_1 = 32, e_2 = 49 is a valid RSA exponent? Justify your choice b. Compute the corresponding private key Kpr = (p, q, d). Use the extended Euclidean algorithm for the inversion and point out every calculation step. c. Using the encryption key, encrypt the...

  • For the RSA encryption algorithm , do the following (a) Use p=257,q=337(n=pq=86609),b=(p-1)(q-1)=86016. Gcd(E,b)=1, choose E=17, find...

    For the RSA encryption algorithm , do the following (a) Use p=257,q=337(n=pq=86609),b=(p-1)(q-1)=86016. Gcd(E,b)=1, choose E=17, find D, the number which has to be used for decryption, using Extended Euclidean Algorithm (b) One would like to send the simple message represented by 18537. What is the message which will be sent? (c) Decrypt this encrypted message to recover the original message.

  • Write code for RSA encryption package rsa; import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class RSA...

    Write code for RSA encryption package rsa; import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class RSA {    private BigInteger phi; private BigInteger e; private BigInteger d; private BigInteger num; public static void main(String[] args) {    Scanner keyboard = new Scanner(System.in); System.out.println("Enter the message you would like to encode, using any ASCII characters: "); String input = keyboard.nextLine(); int[] ASCIIvalues = new int[input.length()]; for (int i = 0; i < input.length(); i++) { ASCIIvalues[i] = input.charAt(i); } String ASCIInumbers...

  • Crypotography Question 1. A message m was encrypted using the RSA algorithm with n=899 and e=13....

    Crypotography Question 1. A message m was encrypted using the RSA algorithm with n=899 and e=13. The ciphertext is 706. Find the message m. Show all the work from the scratch, including finding 1/e(using the extended Euclidean algorithm) and the resulting modular exponentiation...

  • 5. We must assume that keys are not secure forever, and will eventually be discovered; thus...

    5. We must assume that keys are not secure forever, and will eventually be discovered; thus keys should be changed periodically. Assume Alioe sets up a RSA cryptosystem and announces N = 3403, e = 11. (a) Encrypt m = 37 using Alice's system (b) At some point. Eve discovers Alice's decryption exponent is d = 1491. Verify this (by decrypting the encrypted value of rn = 37). (c) Alice changes her encryption key to e = 31, Encrypt rn...

  • If a public key has the value (e, n)-(13,77) (a) what is the totient of n,...

    If a public key has the value (e, n)-(13,77) (a) what is the totient of n, or (n)? (b) Based on the answer from part (a), what is the value of the private key d? (Hint: Remember that d * e-1 mod (n), and that d < ф(n)) You may use an exhaustive search or the Modified Euclidean Algorithm for this. Show all steps performed. For both (c) and (d), use the Modular Power Algorithm, showing all steps along the...

  • Write a program in Python implement the RSA algorithm for cryptography. Set up: 1.Choose two large...

    Write a program in Python implement the RSA algorithm for cryptography. Set up: 1.Choose two large primes, p and q. (There are a number of sites on-line where you can find large primes.) 2.Compute n = p * q, and Φ = (p-1)(q-1). 3.Select an integer e, with 1 < e < Φ , gcd(e, Φ) = 1. 4.Compute the integer d, 1 < d < Φ such that ed ≡ 1 (mod Φ). The numbers e and d are...

  • (16 pts) In the RSA public key cryptography system (S,N,e,d,E,D), let p = 347, q =...

    (16 pts) In the RSA public key cryptography system (S,N,e,d,E,D), let p = 347, q = 743, and N = 347 · 743 = 247821. (a) (8 pts) Which of the two numbers 4193, 4199 can be an encryption key, and why? If one of them can be an encryption key e, find its corresponding decryption key d. (b) (8 pts) How many possible pairs (e,d) of encryption and decryption keys can be made for the RSA system? (If you...

  • Bob chooses 7 and 11 as p and q prime numbers. Now he chooses two exponents...

    Bob chooses 7 and 11 as p and q prime numbers. Now he chooses two exponents e to be 13, then d is 37. Note e * d mod 60 = 1 i.e. they are inverse to each other. Now imagine that Alice wants to send the plaintext 5 to Bob. She uses RSA algorithm to encrypt the message (perform encryption). Also, show your work how Bob perform decryption operation in order to extract plaintext. PLEASE SHOW ALL WORK AND...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT