-
Notifications
You must be signed in to change notification settings - Fork 6
/
Vignere.py
61 lines (59 loc) · 3.2 KB
/
Vignere.py
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
banner = """\u001b[36;1m
█████▄ ██▀███ ▄▄▄ ▄████ ▒█████ ███▄ ▄███ ▄███ ▓▓▄ █
▒██ ██▌▓██ ▒ ██▒▒████▄ ██▒ ▀█▒▒██ ██▒ ██▒▀█▀█ █ ▒██ ██ ▄ ██ ▀█ █
░██ █▌▓██ ▄█ ▒▒██ ▀█▄ ▒██░▄▄▄░▒██░ ██ ▓██ ▓██▒ ██ ▀█▄▓ ██ ▀█ ██▒
░▓█▄ ▌▒██▀▀█▄ ░██▄▄▄▄██ ░▓█ ██▓▒██ ██░▒██ ▒██ ░██▄▄▄▄██ ▓██▒ ▐▌██▒
░▒████▓ ░██▓ ▒██▒ ▓█ ▓██▒░▒▓███▀▒░ ████▓▒░▒██▒ ░██▒ ▓█ ▓██▒▒██░ ▓██░
▒▒▓ ▒ ░ ▒▓ ░▒▓░ ▒▒ ▒█░ ░▒ ▒ ░ ▒░▒░▒░ ░ ▒░ ░ ░ ▒▒ ▓▒█░░ ▒░ ▒ ▒
░ ▒ ▒ ░▒ ░ ▒░ ▒ ▒▒ ░ ░ ░ ░ ▒ ▒░ ░ ░ ░ ▒ ▒▒ ░░ ░░ ░ ▒░
░ ░ ░ ░░ ░ ░ ▒ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░ ▒ ░ ░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
\u001b[32;1m
--Presented with <3 by Shivanshu Sharma
\u001b[35 _ _ __ _ ____ ___ ____ __ _ ___ _ ____ ___
\ \ / | | / /`_ | |\ | | |_ | |_) | |_ / /` | | | |_) | |_| | |_ | |_)
\_\/ |_| \_\_/ |_| \| |_|__ |_| \ |_|__ \_\_, |_| |_| |_| | |_|__ |_| \
\u001b[32;1m \u001b[0m """
print(banner)
menu=""" \u001b[33;1m
------------------------------------------
LIST OF DECODERS |
------------------------------------------
[+] ASCII CONVERTER -- Ascii.py |
[+] ATBASH DECODER -- Atbash.py |
[+] CAESER DECODER -- Caeser.py |
[+] BACON DECODER -- Bacon.py |
[+] BASE32 DECODER -- Base32.py |
[+] BASE64 DECODER -- Base64.py |
[+] BASE85 DECODER -- Base85.py |
[+] DNA DECODER -- Dna.py |
[+] MORSE DECODER -- Morse.py |
[+] NUMBER SYSTEM -- Num.py |
[!] BINARY TO TEXT |
[!] HEX TO TEXT |
[!] OCTAL TO TEXT |
[+] RAILFENCE DECODER -- Rail.py |
[+] REVERSE CIPHER -- Reverse.py |
[+] ROTn DECODER -- Rot.py |
[+] TRANSPOSITION CIPHER -- Trans.py |
[+] VIGNERE DECODER -- Vignere.py |
------------------------------------------
\u001b[32;1m"""
print(menu)
a = input('Enter cipher text: ')
b = input('Enter key: ')
a = a.lower()
b = b.lower()
c = ''
j=0
for i in a:
if not ord('a') <= ord(i) <= ord('z'):
c += i
else:
first = ord(i) - ord('a')
second = ord(b[j]) - ord('a')
c += chr((first - second) % 26 + ord('a'))
j += 1
if j == len(b):
j = 0
print ('The plain text: '+ c)