fix rsa3 and kill rsa4

This commit is contained in:
Jacob Magnuson 2017-03-11 06:47:41 +00:00
parent afd661e85e
commit f54973edc8
23 changed files with 34 additions and 127 deletions

View file

@ -1,9 +1,17 @@
Write a program that outputs the numbers 1 through n, in incremental order, one per line. Write a program that takes an integer `n` as input.
However, replace any line that is a multiple of 3 with "Fizz" and any that are a multiple of 5 with "Buzz". Any line that is a multiple of 3 and 5 should be written as "FizzBuzz". Output the numbers 1 through `n`, in increasing order, one per line.
However, replace any line that is a multiple of 3 with `Fizz` and any that are a multiple of 5 with `Buzz`. Any line that is a multiple of 3 and 5 should be written as `FizzBuzz`.
The input will be the number of lines to write, n, followed by a linebreak. The input will be the number of lines to write, n, followed by a linebreak.
Sample input:
```
17
```
Sample output: Sample output:
``` ```
@ -12,14 +20,16 @@ Sample output:
Fizz Fizz
4 4
Buzz Buzz
Fizz
... 7
8
Fizz
Buzz
11
Fizz
13 13
14 14
FizzBuzz FizzBuzz
16 16
17 17
...
``` ```

View file

@ -1,4 +1,12 @@
def grade(random, key): n = input()
if key.find("PUT A NEW KEY HERE!!!!") != -1:
return True, "Correct!" for i in range(1, n + 1):
return False, "Nope." if i % 3 == 0 and i % 5 == 0:
print 'FizzBuzz'
elif i % 3 == 0:
print 'Fizz'
elif i % 5 == 0:
print 'Buzz'
else:
print i

View file

@ -1,5 +1 @@
<<<<<<< HEAD We came across another [message]($rsa3) that follows the same cryptographic schema as those other RSA messages. Take a look and see if you can crack it.
I found somebody's notes on their private RSA! Help me crack [this](${ciphertext_txt}).
=======
We came across another [message]($rsa3) that follows the same cryptographic schema as those other Really Scary Admin messages. Take a look and see if you can crack it.
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657

View file

@ -1,56 +1,4 @@
<<<<<<< HEAD
from cStringIO import StringIO
flag = "wh3n_y0u_h4ve_p&q_RSA_iz_ez"
def modx(base,exp,mod):
r = 1;
while (exp > 0):
if (exp % 2 == 1):
r = (r * base) % mod
base = (base * base) % mod
exp = exp/2
return r
def probprime(s):
if s%2==0:
s += 1
smolprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
while len(set([modx(i,s-1,s) for i in smolprimes])) != 1 or modx(2,s-1,s) != 1:
s+=2
return(s)
def get_problem(random):
# add Probable Prime function later
p = probprime(random.randint(3*10**79,4*10**79))
q = probprime(random.randint(3*10**79,4*10**79))
e = 3
salt = "".join([random.choice("0123456789abcdef") for i in range(8)])
return (p, q, e, salt)
def generate_ciphertext(random):
p, q, e, salt = get_problem(random)
encoded = int(("easyctf{%s_%s}" % (flag, salt)).encode('hex'),16)
ciphertext = 'p: '+str(p)+'\n'
ciphertext += 'q: '+str(q)+'\n'
ciphertext += 'e: '+str(e)+'\n'
ciphertext += 'c: '+str(pow(encoded, e, p*q))+'\n'
return StringIO(ciphertext)
def generate(random):
return dict(files={
"ciphertext_rsa1.txt": generate_ciphertext
})
def grade(random, key):
n, salt = get_problem(random)
if key.find("%s_%s" % (flag, salt)) >= 0:
return True, "Correct!"
return False, "Nope."
=======
def grade(autogen, key): def grade(autogen, key):
if key.find("tw0_v3ry_merrry_tw1n_pr1m35!!_417c0d") != -1: if key.find("tw0_v3ry_merrry_tw1n_pr1m35!!_417c0d") != -1:
return True, "Really Superb! Applause!" return True, "Really Superb! Applause!"
return False, "RIP" return False, "RIP"
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657

View file

@ -1,19 +1,9 @@
<<<<<<< HEAD
title: RSA 1
author: neptunia
hint: Go google RSA if you're stuck.
category: Cryptography
autogen: true
programming: false
value: 25
=======
author: blockingthesky author: blockingthesky
title: RSA 3 title: RSA 3
hint: You might want to read up on how RSA works. hint: You might want to read up on how RSA works.
category: Cryptography category: Cryptography
autogen: false autogen: false
programming: false programming: false
value: 70 value: 135
files: files:
- rsa3 - rsa3
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657

View file

@ -1 +0,0 @@
We came across another [message]($rsa4) that follows the same cryptographic schema as those other RSA messages. Take a look and see if you can crack it.

View file

@ -1,8 +0,0 @@
<<<<<<< HEAD
<<<<<<< HEAD
I found somebody's notes on their private RSA! Help me crack [this](${ciphertext_txt}).
=======
We came across another [message]($rsa3) that follows the same cryptographic schema as those other Really Scary Admin messages. Take a look and see if you can crack it.
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657
=======
>>>>>>> f9a58afef003d40f3ada9c1645eda26363521cf3

View file

@ -1,8 +0,0 @@
<<<<<<< HEAD
<<<<<<< HEAD
I found somebody's notes on their private RSA! Help me crack [this](${ciphertext_txt}).
=======
We came across another [message]($rsa3) that follows the same cryptographic schema as those other Really Scary Admin messages. Take a look and see if you can crack it.
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657
=======
>>>>>>> f9a58afef003d40f3ada9c1645eda26363521cf3

View file

@ -1 +0,0 @@
We came across another [message]($rsa3) that follows the same cryptographic schema as those other Really Scary Admin messages. Take a look and see if you can crack it.

View file

@ -1 +0,0 @@
We came across another [message]($rsa3) that follows the same cryptographic schema as those other Really Scary Admin messages. Take a look and see if you can crack it.

View file

@ -1,5 +0,0 @@
<<<<<<< HEAD
I found somebody's notes on their private RSA! Help me crack [this](${ciphertext_txt}).
=======
We came across another [message]($rsa3) that follows the same cryptographic schema as those other Really Scary Admin messages. Take a look and see if you can crack it.
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657

View file

@ -1,5 +0,0 @@
<<<<<<< HEAD
I found somebody's notes on their private RSA! Help me crack [this](${ciphertext_txt}).
=======
We came across another [message]($rsa3) that follows the same cryptographic schema as those other Really Scary Admin messages. Take a look and see if you can crack it.
>>>>>>> 93577ddee37a489cf0aa1a4b987d23a3bc3d2657

View file

@ -1,4 +0,0 @@
def grade(autogen, key):
if key.find("tw0_v3ry_merrry_tw1n_pr1m35!!_417c0d") != -1:
return True, "Really Superb! Applause!"
return False, "RIP"

View file

@ -1,9 +0,0 @@
author: blockingthesky
title: RSA 4
hint: You might want to read up on how RSA works.
category: Cryptography
autogen: false
programming: false
value: 130
files:
- rsa3

View file

@ -1,2 +0,0 @@
{N : e : c}
{0x27335d21ca51432fa000ddf9e81f630314a0ef2e35d81a839584c5a7356b94934630ebfc2ef9c55b111e8c373f2db66ca3be0c0818b1d4eda7d53c1bd0067f66a12897099b5e322d85a8da45b72b828813af23L : 0x10001 : 0x9b9c138e0d473b6e6cf44acfa3becb358b91d0ba9bfb37bf11effcebf9e0fe4a86439e8217819c273ea5c1c5acfd70147533aa550aa70f2e07cc98be1a1b0ea36c0738d1c994c50b1bd633e3873fc0cb377e7L}

View file

@ -1,2 +0,0 @@
{N : e : c}
{0x27335d21ca51432fa000ddf9e81f630314a0ef2e35d81a839584c5a7356b94934630ebfc2ef9c55b111e8c373f2db66ca3be0c0818b1d4eda7d53c1bd0067f66a12897099b5e322d85a8da45b72b828813af23L : 0x10001 : 0x9b9c138e0d473b6e6cf44acfa3becb358b91d0ba9bfb37bf11effcebf9e0fe4a86439e8217819c273ea5c1c5acfd70147533aa550aa70f2e07cc98be1a1b0ea36c0738d1c994c50b1bd633e3873fc0cb377e7L}

View file

@ -5,6 +5,7 @@ autogen: false
programming: true programming: true
value: 15 value: 15
grader_language: python
test_cases: 10 test_cases: 10
time_limit: 1000 time_limit: 1000
memory_limit: 256000 memory_limit: 256000

View file

@ -7,7 +7,7 @@ elif N == 1:
elif N == 2: elif N == 2:
print '123 456 3\n5 7 11' print '123 456 3\n5 7 11'
elif N == 3: elif N == 3:
print '1 10000000 16\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16' print '1 10000000 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
else: else:
import random as r import random as r
r.seed(N) r.seed(N)

Binary file not shown.

View file

@ -1 +0,0 @@
# done in grader.java

View file

@ -5,6 +5,7 @@ autogen: false
programming: true programming: true
value: 210 value: 210
grader_language: java
test_cases: 15 test_cases: 15
time_limit: 1000 time_limit: 1000
memory_limit: 256000 memory_limit: 256000