ceasar_cipher module

ceasar_cipher.create_shifted_alphabet(shift: int)[source]

Return a dictionary where the keys are the original letters in the alphabet and the values are the corresponding letters in the shifted alphabet

Parameters

shift (int) – The shift

Returns

The dictioary with the shifted alphabet

Return type

dict

Example

>> shifted_alphabet = create_shifted_alphabet(2)
>> shifted_alphabet["d"]
"f"
ceasar_cipher.encrypt(msg: str, shift: int) str[source]

Encrypt message

Parameters
  • msg (str) – The message

  • shift (int) – The shift

Returns

Encrypted message

Return type

str

Raises

TypeError – [description]

ceasar_cipher.rotate_string(msg: str, shift: int) str[source]

Rotate string with a given shift

Parameters
  • msg (str) – The string you want to roate

  • shift (int) – The shift

Returns

The rotated string

Return type

str

Example

>> rotated_string("hello", 1)
"ohell"