NIS Practical 5
NIS Practical 5
5
Aim: Write a program to implement Caesar Cipher
Introduction:
• Each letter of plain text is replaced by a letter with some fixed number of positions
down with alphabet.
Explanation
• After the steps is followed, a new string is generated which is referred as cipher
text.
Feature of Caesar Cipher Algorithm
This algorithm consists of a few features that are given below. o This technique is quite
simple to apply encryption. o Each text is replaced by the fixed number of position
down or up with the alphabet. o It is a simple type of substitute cipher.
There is an integer value required to define each latter of the text that has been move
down. This integer value is also known as the shift.
We can represent this concept using modular arithmetic by first transmuting the letter
into numbers, according to the schema, A = 0, B = 1, C = 2, D = 3 Z = 25.
Program:
#A python program to illustrate
Caesar Cipher Technique
def encrypt(text,s):
result = ""
# traverse text
for i in range(len(text)):
char = text[i]
return result
Conclusion :
The Caesar Cipher technique is one of the earliest and simplest method of
encryption technique. It’s simply a type of substitution cipher, i.e., each letter of a
given text is replaced by a letter some fixed number of positions down the alphabet.
For example with a shift of 1, A would be replaced by B, B would become C, and
so on. The method is apparently named after Julius Caesar, who apparently used it
to communicate with his officials.
Thus to cipher a given text we need an integer value, known as shift which
indicates the number of position each letter of the text has been moved down