Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package rsaMath;
- /**
- * :0 <--3
- * cicada ^ ^penis
- *
- * (d*e)mod φ(n) = 1
- * ^ math
- *
- * @author kzm
- *
- */
- public class PrivateKeyBruteForce {
- public static void main(String[] args){
- //This is example data
- int p = 37;
- int q = 23;
- int n = 851;
- int phi = (p-1)*(q-1);
- int e = 5;
- int d = 0; //This is the private key
- boolean key_found = false;
- while(!key_found){
- d++;
- if((d*e)%phi == 1){
- key_found = true;
- }
- }
- System.out.println("D = "+d);
- }
- }
Add Comment
Please, Sign In to add comment