Exemple #1
0
 def test_caesar_cipher(self):
     self.assertEqual("Lipps_Asvph!", caesar_cipher("Hello_World!", 4))
     self.assertEqual("okffng-Qwvb", caesar_cipher("middle-Outz", 2))
 def test_caesar_cipher(self):
     self.assertEqual("Lipps_Asvph!", caesar_cipher("Hello_World!", 4))
     self.assertEqual("okffng-Qwvb", caesar_cipher("middle-Outz", 2))
Exemple #3
0
"""
Julius Caesar protected his confidential information by encrypting it using a cipher.
Caesar's cipher shifts each letter by a number of letters. If the shift takes you
past the end of the alphabet, just rotate back to the front of the alphabet.
In the case of a rotation by 3, w, x, y and z would map to z, a, b and c.
Original alphabet:      abcdefghijklmnopqrstuvwxyz
Alphabet rotated +3:    defghijklmnopqrstuvwxyzabc
"""

from algorithms.strings import caesar_cipher

a = "abcdefghijklmnopqrstuvwxyz"
k = 3
print(caesar_cipher(a, k))
def step_impl(context, alphabet):
    context.result = strings.caesar_cipher(alphabet, 0)