From e03061351748be5638ce1870d0162ef8d5e296fc Mon Sep 17 00:00:00 2001 From: neptunia Date: Sat, 18 Mar 2017 14:39:58 -0400 Subject: [PATCH] fix grader --- premium-rsa/grader.py | 69 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/premium-rsa/grader.py b/premium-rsa/grader.py index 3ca2140..b703b0e 100644 --- a/premium-rsa/grader.py +++ b/premium-rsa/grader.py @@ -21,41 +21,40 @@ def modinv(a, m): def randleetify(s, random): i = list(s) for c in range(len(i)): - if random.random() > 0.5: - if i[c] == 'i': - if random.random() > 0.66: - i[c] = '1' - elif random.random() > 0.33: - i[c] = 'I' - elif i[c] == 'o': - if random.random() > 0.66: - i[c] = '0' - elif random.random() > 0.33: - i[c] = 'O' - elif i[c] == 'a': - if random.random() > 0.66: - i[c] = '4' - elif random.random() > 0.33: - i[c] = 'A' - elif i[c] == 'l': - if random.random() > 0.66: - i[c] = '1' - elif random.random() > 0.33: - i[c] = 'L' - elif i[c] == 's': - if random.random() > 0.66: - i[c] = '5' - elif random.random() > 0.33: - i[c] = 'S' - elif i[c] == 'e': - if random.random() > 0.66: - i[c] = '3' - elif random.random() > 0.33: - i[c] = 'E' - elif i[c].isalpha(): - if random.random() > 0.5: - i[c] = i[c].upper() - return ''.join(i) + if i[c] == 'i': + if random.random() > 0.66: + i[c] = '1' + elif random.random() > 0.33: + i[c] = 'I' + elif i[c] == 'o': + if random.random() > 0.66: + i[c] = '0' + elif random.random() > 0.33: + i[c] = 'O' + elif i[c] == 'a': + if random.random() > 0.66: + i[c] = '4' + elif random.random() > 0.33: + i[c] = 'A' + elif i[c] == 'l': + if random.random() > 0.66: + i[c] = '1' + elif random.random() > 0.33: + i[c] = 'L' + elif i[c] == 's': + if random.random() > 0.66: + i[c] = '5' + elif random.random() > 0.33: + i[c] = 'S' + elif i[c] == 'e': + if random.random() > 0.66: + i[c] = '3' + elif random.random() > 0.33: + i[c] = 'E' + elif i[c].isalpha(): + if random.random() > 0.5: + i[c] = i[c].upper() + return ''.join(i) def get_problem(random): n_length = 2048