|
|
@ -4,18 +4,39 @@ import java.util.Scanner; |
|
|
|
|
|
|
|
public class ITsecAufgaben { |
|
|
|
|
|
|
|
|
|
|
|
public static void zweiteAufgabe() { |
|
|
|
System.out.println("\nBerechnen Sie RSA per Hand. Taschenrechner & Website erlaubt.\n"); |
|
|
|
System.out.println("Gegeben sind: p = 13, q = 17, e = 11, P1 = 23"); |
|
|
|
System.out.println("Geben Sie das Ergebnis für N, phiOfN, encKey, decKey & C1:\n"); // <-- hier ggf. refactoring |
|
|
|
|
|
|
|
int N = 0, phiOfN = 0, decKey = 0, C1= 0, encKey = 0; |
|
|
|
//String encKey = "(221, 11)"; |
|
|
|
boolean bool = true; |
|
|
|
int N = 0, phiOfN = 0, decKey = 0, C1 = 0, encKey = 0; |
|
|
|
// String encKey = "(221, 11)"; |
|
|
|
|
|
|
|
Scanner in = new Scanner(System.in); |
|
|
|
|
|
|
|
while (bool) { |
|
|
|
|
|
|
|
System.out.println( |
|
|
|
"Ergebnisse für N, phiOfN, decKey, Cipher1 & encKey eingeben:\n Vorsicht: encKey besteht aus N & '?' angehangen ; alle Werte sind integer"); |
|
|
|
System.out.println("N:"); |
|
|
|
N = in.nextInt(); |
|
|
|
System.out.println("phiOfN:"); |
|
|
|
phiOfN = in.nextInt(); |
|
|
|
System.out.println("decKey:"); |
|
|
|
decKey = in.nextInt(); |
|
|
|
System.out.println("C1:"); |
|
|
|
C1 = in.nextInt(); |
|
|
|
System.out.println("encKey:"); |
|
|
|
encKey = in.nextInt(); |
|
|
|
|
|
|
|
if (N == 221 && phiOfN == 192 && encKey == 22111 && decKey == 35 && C1 == 56) { |
|
|
|
System.out.println("\nRichtiges Ergebnis\n"); |
|
|
|
|
|
|
|
} else { |
|
|
|
System.out.println("\nFalsches Ergebnis\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
in.close(); |
|
|
|
|
|
|
|