Beispiel #1
0
 def test_atbash_cipher(self):
     self.assertEqual("zyxwvutsrqponml", atbash("abcdefghijklmno"))
     self.assertEqual("KbgslM", atbash("PythoN"))
     self.assertEqual("AttaCK at DawN", atbash("ZggzXP zg WzdM"))
     self.assertEqual("ZggzXP zg WzdM", atbash("AttaCK at DawN"))
Beispiel #2
0
 def test_atbash_cipher(self):
     self.assertEqual("zyxwvutsrqponml", atbash("abcdefghijklmno"))
     self.assertEqual("KbgslM", atbash("PythoN"))
     self.assertEqual("AttaCK at DawN", atbash("ZggzXP zg WzdM"))
     self.assertEqual("ZggzXP zg WzdM", atbash("AttaCK at DawN"))
"""
Atbash cipher is mapping the alphabet to it's reverse.
So if we take "a" as it is the first letter, we change it to the last - z.
Example:
Attack at dawn --> Zggzxp zg wzdm
Complexity: O(n)
"""

from algorithms.strings import atbash

a="Attack at dawn"
print(atbash(a))