| NoTeefy | after that you can just apply your modulus on it |
| Bread | But I don't want my BigInteger to have a value |
| Bread | Does that mean |
| Bread | BigInteger c = new BigInteger(); |
| Bread | ? :D |
| NoTeefy | something like that should work. Let me check if you need a special function for a modulus on a BigInteger real quick |
| Bread | Oh wow really good |
| NoTeefy | oh okay |
| Bread | I wouldn't have thought about that |
| NoTeefy | got it, let me write you the solution |
| Bread | Thanks a lot! |
| Bread | ```java
public void inputs(double p, double q, double e, double m, double d) {
//Encrypting a message
System.out.println(0 |
| NoTeefy | ```java
public void test() {
BigInteger a = new BigInteger(„8“);
BigInteger b = new BigInteger(„13“);
BigInteger c = a.modPow(b, new BigInteger(„77“));
System.out.println("Result should actually be 45. However it is "+ c);
}
``` |
| NoTeefy | that should work. It‘s hard to write in proper syntax on a smartphone while almost falling asleep 🙈 |
| Bread | Haha :D thx |
| Bread | Let me try that |
| NoTeefy | try it |
| Bread | it doesn't even allow import java.math.BigInteger; |
| NoTeefy | The thing is: You wanna use BigIntegers instead of the normal data types because of the size limitations. The result of Math.pow(8, 13) is too big hence the number gets shortened/rounded. That‘s why it won‘t produce the correct result. |
| Bread | Okay I see |