Decrypt class that uses RSAbreaker library (https://github.com/cybernova/RSAbreaker)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigInteger; | |
public class Decrypt { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
//master public key | |
String stringa = "75974c3b8446de2c2af495a85dc0cd6ddad7d4921e1382346a708d8f7cf70492557ff1a227b29e41ac9080911893c2b17bad2bf3ffafdb2b51be1da327e3a757085abec11df604f81cbe5bb167fbe4c8da750070b11770246c096374ac4b0a1d71ae7fae65b8c58679c57e9f98604c52b92962cb2329ed3191747b7b0b261bf27d67bfda7a40daf2614d94a57dad596bad9ea33a39c65b6e9fd2bb36b5f5d265f52c30d8c117bdaf2800962046a72d62030cd7d075a00b07ead41fcae8d94edb38f22675cb12a688709be1ea32dcf871725041e617816827428edfe5dea172d93bfbe59d30116992cd602be2d5463c28cf9d304af7adb9fb0f91fe2ebe18f1ce"; | |
BigInteger key = RSAbreaker.hexToBigInteger(stringa); | |
//public exponent | |
String pex = "010001"; | |
BigInteger exp = RSAbreaker.hexToBigInteger(pex); | |
//finding the private key | |
RSAbreaker.pollardRho(key, exp); | |
//plain text message | |
String messaggio = "000100ef21eee012947583"; | |
BigInteger mex = RSAbreaker.hexToBigInteger(messaggio); | |
System.out.println(RSAbreaker.bigIntegerToHex(mex)); | |
BigInteger result = mex.modPow(exp, key); | |
System.out.println(RSAbreaker.bigIntegerToHex(result)); | |
//decrypting with the use of the private key found | |
BigInteger privkey = RSAbreaker.hexToBigInteger("b9a8170420e48302d90f30fa928b45cc9c2907c56b17020c1fc174bf875dba2a1033e11d53efff4d515714a60157c99cced7aafda243d495a089b9e14fa96f1b4a657ba70bd6d221a9c022a506b7fd8fe0d9b9c832d1fe8c82c68ff035d68431d8bad97c4fbe5a9ee6c39a18004c8a345183b627636d5ec15415c49f900aab354029fe0ec3d681d90d279ff96963b83af9f3ed6290b54cc66c301ac556a4b77ba28c12d3268a854176b6f6501f3cf3ba3b769b86d52fca3ac5d8041a29686fc84f3082e897a6eaa7a0a37d1c7711ca6fd33c43cf346d6c341031e3eeda81ad02ae621735061f77bfffe24767ebb2e868c6e236cd261f73f39fb1b0cfbbf3465"); | |
System.out.println(RSAbreaker.bigIntegerToHex(result.modPow(privkey, key))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment