Repository navigation
Expand file tree
/
Copy pathdecrypt.py
More file actions
76 lines (58 loc) · 2.31 KB
/
Copy pathdecrypt.py
File metadata and controls
76 lines (58 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# NOTE: GO TO THE NUMBER FIRST DAWG
# DEFINITIONS
# Note: Runes and Letters ordering is significant and the decimal value of their index (starting at 0) corresponds to
# the key released by Cicada 3301 in 2013.
RUNES = ["ᚠ", "ᚢ", "ᚦ", "ᚩ", "ᚱ", "ᚳ", "ᚷ", "ᚹ", "ᚻ", "ᚾ", "ᛁ", "ᛄ", "ᛇ", "ᛈ", "ᛉ", "ᛋ", "ᛏ", "ᛒ", "ᛖ", "ᛗ", "ᛚ", "ᛝ",
"ᛟ", "ᛞ", "ᚪ", "ᚫ", "ᚣ", "ᛡ", "ᛠ"]
LETTERS = ["F", "V(U)", "TH", "O", "R", "C(K)", "G", "W", "H", "N", "I", "J", "EO", "P", "X", "S(Z)", "T", "B", "E",
"M", "L", "NG(ING)", "OE", "D", "A", "AE", "Y", "IA(IO)", "EA"]
MODULO = len(RUNES)
# VARIABLES
test = input("Enter encrypted text: ")
running_string = ""
output = []
# DIRECT TRANSLATION
for x in test: # iterate through entire test input
if (x == '/') or (x == '.'): # test for line break
output.append(running_string) # append to output list
running_string = "" # reset translated string
elif x == '-':
running_string += " "
else:
running_string += LETTERS[RUNES.index(x)] # translate directly from rune to letter, add to string
# If translated string still has length, append it
if len(running_string):
output.append(running_string)
# Display results
print("\nDirect Rune to Latin Alphabet Letter(s) Translation:")
print(output)
# Clear output and string
output[:] = []
running_string = ""
# ATBASH CIPHER
for x in test: # iterate through entire test input
if (x == '/') or (x == '.'): # test for line break
output.append(running_string) # append to output list
running_string = "" # reset translated string
elif x == '-':
running_string += " "
else:
running_string += LETTERS[28 - RUNES.index(x)] # translate rune to letter using atbash cipher
# If translated string still has length, append it
if len(running_string):
output.append(running_string)
print("\nAtbash Cipher Translation:")
print(output)
shift = input("\n\nEnter shift: ")
big_string = ""
new_string = ""
# Shift
for y in output:
big_string += " " + y
for x in big_string:
if (x == ' ') or (x == '(') or (x == ')'):
new_string += x
else:
new_string += LETTERS[(LETTERS.index(x) + int(shift)) % MODULO]
print("\nShifted Atbash Cipher")
print(new_string)