0 Members and 2 Guests are viewing this topic.
Could I have that number in hex?
static void Main(string[] args) { // Boot2 Key: // c3b3a7015c04299ff3a25f104e2285c1ec2d55471e6208959d0f6981b2fa2c6d // 3e316f9364d5eb5c7789e142b75bfaf402e7e02fac0cb09f6419db1f44679f8b // bcca142f1d312feb095708ef175a4ef80271321e7240f0d854c90a74fc59209c // df80aa8f85ae3b948a3ce55c69cd050098d5a79aebbc241cc642b106b1af2cb7 // Other keys: // aba7f0b8c7feb6e33438af5c25c67389eaf4d73f80cd0a37922493431cde03b3 // 4da448bdb05387cf7a8c59ee12d9613429a2b07ea385752f079892da1ae76c2b // 158f2d7169aae066432fe44f797df39dd6a0d7b2e2091281b30efac247c51576 // ebc93ec456de2e27d36b713844336b65af67ee58e6107a6a1deb954a91095295 // b15e01c47c421be62f4e769b3ac98f4f983a820b0c181e35715d84a4f1acf052 // 7eeddfabf9f66e73bedb55376e22f860c34dc70ce239157297056d4ecf465357 // 78c3917647b5a6bb9c5638cdeff3e309ff66878fd4f233cf157d7af4136f307d // f90ec6ae6eaff6bead6d52f423a37dac59ff38ae876008103728f2bd674e858f Console.WriteLine("Factoring 1024-bit TI-Nspire boot2 RSA Key:"); Console.WriteLine("0xc3b3a7015c04299ff3a25f104e2285c1ec2d55471e6208959d0f6981b2fa2c6d"); Console.WriteLine("0x3e316f9364d5eb5c7789e142b75bfaf402e7e02fac0cb09f6419db1f44679f8b"); Console.WriteLine("0xbcca142f1d312feb095708ef175a4ef80271321e7240f0d854c90a74fc59209c"); Console.WriteLine("0xdf80aa8f85ae3b948a3ce55c69cd050098d5a79aebbc241cc642b106b1af2cb7"); BigInteger key = new BigInteger("c3b3a7015c04299ff3a25f104e2285c1ec2d55471e6208959d0f6981b2fa2c6d" + "3e316f9364d5eb5c7789e142b75bfaf402e7e02fac0cb09f6419db1f44679f8b" + "bcca142f1d312feb095708ef175a4ef80271321e7240f0d854c90a74fc59209c" + "df80aa8f85ae3b948a3ce55c69cd050098d5a79aebbc241cc642b106b1af2cb7", 16); BigInteger startValue = new BigInteger("1552518092300708935148979488462502555256886017116696611139052038026050952686376886330878408828646477950487730697131073206171580044114814391444287275041181139204454976020849905550265285631598444825262999193716468750892846853816057856", 10); string maxNumber = ""; while (maxNumber.Length * 8 < 512) maxNumber += "F"; BigInteger maxValue = new BigInteger(maxNumber, 8); Console.Write("\n"); BigInteger numberOne = startValue, numberTwo = startValue + 2; BigInteger numberOfTests = 0; BigInteger temp = 0; BigInteger distance = 356; while (true) { Console.Clear(); numberOfTests++; Console.WriteLine("Number of tests thus far: {0}\n", numberOfTests.ToString()); Console.WriteLine("Current numbers:"); Console.WriteLine(numberOne.ToHexString() + "\n"); Console.WriteLine(numberTwo.ToHexString()); if (numberOne * numberTwo == key) { Console.WriteLine("----Key found----"); while (true) Console.ReadLine(); // Stop here } Console.WriteLine("Current test done, searching for next prime pair..."); while (true) { numberOne++; if ((numberOne - numberTwo).abs() > 356) { numberTwo++; while (!numberTwo.isProbablePrime()) numberTwo++; numberOne = numberTwo + 2; while (!numberOne.isProbablePrime()) numberTwo++; break; } if (numberOne.isProbablePrime()) break; } } }
BigInteger maxValue = new BigInteger(maxNumber, 8);
One major issue is duplication.
...I'll add some stuff to reduce redundancy when others use it simultaneously...