Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,35 +1,35 @@
|
|||
def caesar_encode(plaintext, shift)
|
||||
uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
lowercase = "abcdefghijklmnopqrstuvwxyz"
|
||||
uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
lowercase = "abcdefghijklmnopqrstuvwxyz"
|
||||
|
||||
cipher = ""
|
||||
for char in plaintext
|
||||
if char in uppercase
|
||||
cipher += uppercase[uppercase[char] - (26 - shift)]
|
||||
else if char in lowercase
|
||||
cipher += lowercase[lowercase[char] - (26 - shift)]
|
||||
else
|
||||
cipher += char
|
||||
end
|
||||
end
|
||||
cipher = ""
|
||||
for char in plaintext
|
||||
if char in uppercase
|
||||
cipher += uppercase[uppercase[char] - (26 - shift)]
|
||||
else if char in lowercase
|
||||
cipher += lowercase[lowercase[char] - (26 - shift)]
|
||||
else
|
||||
cipher += char
|
||||
end
|
||||
end
|
||||
|
||||
return cipher
|
||||
return cipher
|
||||
end
|
||||
|
||||
def caesar_decode(cipher, shift)
|
||||
uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
lowercase = "abcdefghijklmnopqrstuvwxyz"
|
||||
uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
lowercase = "abcdefghijklmnopqrstuvwxyz"
|
||||
|
||||
plaintext = ""
|
||||
for char in cipher
|
||||
if char in uppercase
|
||||
plaintext += uppercase[uppercase[char] - shift]
|
||||
else if char in lowercase
|
||||
plaintext += lowercase[lowercase[char] - shift]
|
||||
else
|
||||
plaintext += char
|
||||
end
|
||||
end
|
||||
plaintext = ""
|
||||
for char in cipher
|
||||
if char in uppercase
|
||||
plaintext += uppercase[uppercase[char] - shift]
|
||||
else if char in lowercase
|
||||
plaintext += lowercase[lowercase[char] - shift]
|
||||
else
|
||||
plaintext += char
|
||||
end
|
||||
end
|
||||
|
||||
return plaintext
|
||||
return plaintext
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue