You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
644B

  1. import java.math.BigInteger;
  2. public class Main {
  3. static BigInteger cipher (BigInteger message, BigInteger key, BigInteger module) {
  4. return message.modPow(key, module);
  5. }
  6. public static void main(String[] args) {
  7. BigInteger prime = Prime.generate(32);
  8. System.out.println("Finished - number is "+prime);
  9. RSA test = new RSA (32);
  10. test.createKeys();
  11. System.out.println(String.format("public key: 0x%X", test.getPublicKey()));
  12. System.out.println(String.format("private key: 0x%X", test.getPrivateKey()));
  13. System.out.println(String.format("RSA module: 0x%X", test.getRSAModule()));
  14. }
  15. }