Skip to content

Commit

Permalink
[New Challenge] Issue 1256 RSA No padding brute force challenge (juic…
Browse files Browse the repository at this point in the history
…e-shop#1274)

[New Challenge] Issue 1256 RSA No padding brute force challenge
  • Loading branch information
jainendra authored and bkimminich committed Jan 13, 2020
1 parent 3af3826 commit bffa158
Show file tree
Hide file tree
Showing 6 changed files with 1,233 additions and 0 deletions.
1,194 changes: 1,194 additions & 0 deletions ftp/announcement_encrypted.md

Large diffs are not rendered by default.

Binary file added ftp/encrypt.pyc
Binary file not shown.
7 changes: 7 additions & 0 deletions test/files/announcement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Major Announcement:

Token Sale - Initial Coin Offering

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Give us all your money. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praes

URL: /#/tokensale-ico-ea
6 changes: 6 additions & 0 deletions test/files/decrypt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Private Parameters
N = 145906768007583323230186939349070635292401872375357164399581871019873438799005358938369571402670149802121818086292467422828157022922076746906543401224889672472407926969987100581290103199317858753663710862357656510507883714297115637342788911463535102712032765166518411726859837988672111837205085526346618740053
d = 89489425009274444368228545921773093919669586065884257445497854456487674839629818390934941973262879616797970608917283679875499331574161113854088813275488110588247193077582527278437906504015680623423550067240042466665654232383502922215493623289472138866445818789127946123407807725702626644091036502372545139713

with open('announcement_encrypted.md', 'r') as fl:
print "".join([chr(pow(int(f[:-1]), d, N)) for f in fl.readlines()])
12 changes: 12 additions & 0 deletions test/files/decrypt_bruteforce.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Public Parameters
N = 145906768007583323230186939349070635292401872375357164399581871019873438799005358938369571402670149802121818086292467422828157022922076746906543401224889672472407926969987100581290103199317858753663710862357656510507883714297115637342788911463535102712032765166518411726859837988672111837205085526346618740053
e = 65537

encrypted_chars = {}

for char in [chr(i) for i in range(33,126)] + [' ', '\n', '\t']:
c = pow(ord(char), e, N)
encrypted_chars[str(c)] = char

with open('announcement_encrypted.md', 'r') as fl:
print "".join([encrypted_chars[f[:-1]] for f in fl.readlines()])
14 changes: 14 additions & 0 deletions test/files/encrypt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
confidential_document = open('announcement.md', 'r')

# Public Parameters
N = 145906768007583323230186939349070635292401872375357164399581871019873438799005358938369571402670149802121818086292467422828157022922076746906543401224889672472407926969987100581290103199317858753663710862357656510507883714297115637342788911463535102712032765166518411726859837988672111837205085526346618740053
e = 65537

encrypted_document = open('announcement_encrypted.md', 'w')

# Encrypt the document!
for char in confidential_document.read():
encrypted_document.write(str(pow(ord(char), e, N)) + '\n')

# Save the file
encrypted_document.close()

0 comments on commit bffa158

Please sign in to comment.