INS Manual
INS Manual
Practical – 1
Aim: Implement Caesar Cipher Encryption and Decryption.
• A Caesar cipher, also known as a shift cipher, is a type of substitution cipher where
each letter in the plaintext is shifted a certain number of places down or up the
alphabet.
• Encryption Process:
• Choose a shift value (key), typically between 1 and 25. For example, if the shift
value is 3, then each letter in the plaintext is replaced by the letter three positions
to the right in the alphabet.
• The alphabet is wrapped around; so after 'Z', it goes back to 'A'. For instance, with
a shift of 3, 'A' becomes 'D', 'B' becomes 'E', and 'Z' becomes 'C'.
• Decryption Process:
• To decrypt, you simply shift the letters back by the same amount. For a shift of 3,
'D' becomes 'A', 'E' becomes 'B', and 'C' becomes 'Z'.
Program: def
caesar_cipher(text, shift):
else:
decrypted_text =
caesar_cipher(encrypted_text, -shift)
if __name__ == "__main__":
main() Output:
Practical – 2
Aim: Implement Monoalphabetic Cipher Encryption and
Decryption.
• Monoalphabetic cipher is a substitution technique where each letter in the plaintext
is replaced by fixed letter of the alphabet.
• Monoalphabetic ciphers would include the Caesar-shift cipher.
• The relationship between a character in the plain text and the characters in the
cipher text is one-to-one.
• In monoalphabetic cipher the value of key does not depend on the position of the
plain text character in the plain text stream.
Program: def
create_substitution_dict(key):
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
return {alphabet[i]: key[i] for i in range(len(alphabet))}
ciphertext
plaintext
decrypt(ciphertext, key)
{plaintext}") print(f"Ciphertext:
{decrypted_text}") Output: