[ Log On ]
  • Home
  • Tst
  • Cha
  • Enc
  • Code
  • IP
  • Fun
  • Sub
  • DigF
  • Cis
  • Com
  • Db
  • About
  • Netsim

RSA Challenge Generator

[Back] This page generates some RSA challenges for cracking. Easy cracking uses 60-bit primes, medium uses 80-bit primes and hard uses 128-bit primes:

In this challenge we will give the encryption key [e,N], and where N can be easily factorized into the original prime numbers (p and q). Once we have cracked for p and q, we can easily find the decryption key [d,N]. Once we have the decryption key, we can then decipher with \(M = Cipher^d\bmod N\).

Difficulty:
Easy (60-bit primes):
Medium (80-bit primes):
Hard (128-bit primes):

Method

Here is an example:

Encryption parameters
e:	65537
N:	1034776851837418228051242693253376923
Cipher:	582984697800119976959378162843817868
We are using  60 bit primes

Now we have to crack N by finding the primes that make up the value.

If we use this [link], we get:

Factors
-------
1,034,776,851,837,418,228,051,242,693,253,376,923 = 1,086,027,579,223,696,553 x 952,809,000,096,560,291

p=1,086,027,579,223,696,553 q=952,809,000,096,560,291

Now we work out PHI, which is equal to \((p-1) \times (q-1)\):

>>>p=1086027579223696553
>>>q=952809000096560291
>>> print (p-1)*(q-1)
1034776851837418226012406113933120080

Now we find \(e^{-1}\bmod PHI\) (and where (\(d\times e)\bmod PHI =1\)), such as using [here]:

Inverse of  65537  mod  1034776851837418226012406113933120080
Result: 568411228254986589811047501435713

This is the decryption key. Finally we decrypt with \(Message=Cipher^{d}\bmod N\):

>>> d=568411228254986589811047501435713
>>> cipher=582984697800119976959378162843817868
>>> N=1034776851837418228051242693253376923
>>> print pow(cipher,d,N)
345

The message is 345

Finally, let's check the answer. So we can recipher with the encryption key and we use \(Cipher = M^{e}\bmod N\):

>>> m=345
>>> e=65537
>>> N=1034776851837418228051242693253376923
>>> print pow(m,e,N)
582984697800119976959378162843817868

This is the same as the cipher, so the encryption and decryption keys have worked. Thus the encryption key is [65537, 1034776851837418228051242693253376923] and the decryption key is [568411228254986589811047501435713, 1034776851837418228051242693253376923]

Presentation