Government Polytechnic, Washim: "Implement Modifier Caesar's Cipher With Shift of Any Key
Government Polytechnic, Washim: "Implement Modifier Caesar's Cipher With Shift of Any Key
Government Polytechnic, Washim: "Implement Modifier Caesar's Cipher With Shift of Any Key
Submitted By
Principal
Dr. B. G. Gawalwad
i
Government Polytechnic ,Washim
CERTIFICATE
During the academic session 2022-2023 in a satisfactory manner in the partial fulfillmentfor the
requirement of Subject: Network &Information Security[22620]
awarded by
Principal
Dr. B. G. Gawalwad
ii
INDEX
SR NO CONTENTS PAGE NO
1 Rationale 1
4 Literature Review 2
9 Skill Developed 8
iii
Annexure – II
Micro-Project Report
Implement Modifier Caesar’s Cipher with shift of any key
1.0 Rationale
Caesar Cipher is named after Julius Caesar and is one of the simplest and weakest encryption
algorithms. Therefore it is used only in parts of other complex encryption algorithms making the
CipherText harder to decode.
Caesar cipher or Shift Cipher is a Substitution cipher algorithm in which each letter of the plain text
(message) is substituted with another letter. In this algorithm, each letter of the Plaintext is shifted a
number of positions based on the Key provided.
This Micro-Project aims at Implement Modifier Caesar’s Cipher with shift of any key.
1
4.0 Literature Review
Caesar cipher or Shift Cipher is a Substitution cipher algorithm in which each letter of the plain text
(message) is substituted with another letter. In this algorithm, each letter of the Plaintext is shifted a
number of positions based on the Key provided.
For example:
PlainText: Hello!
Key: 3
Each letter of the plain text is shifted three times to the next letter.
• H -> K
• e -> h
• l -> o
• l -> o
• o -> r
• ! -> !
Therefore, the CipherText is: Khoor!
2
To decrypt a cipher text, the reverse of encryption process is followed.
Advantages:
Disadvantages:
1. Minimum Security.
2. Frequency of letter pattern gives out the clue in deciphering the message.
3
7.0 Outputs of Micro-project
import java.util.*;
public class CaesarCipherProgram {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String k="y";
while(k.equals("y")||k.equals("Y"))
{
String plaintext="";
int shift=0;
System.out.println("1. Encrypt Message \n2. Decrpyt Message ");
System.out.println("\nEnter your Choice :");
int ch=sc.nextInt();
System.out.println(" Enter Message : ");
plaintext = sc.next();
System.out.println(" Enter the value by which each character in the plaintext message gets shifted : ");
shift = sc.nextInt();
switch(ch)
{
case 1:
String ciphertext = encrypt(plaintext,shift);
System.out.println(" ciphertext : " + ciphertext);
break;
case 2:
String ptext = decrypt(plaintext,shift);
System.out.println(" plaintext : " + ptext);
break;
default:
System.out.println("Option not Selected .. Please Select an option : ");
}
System.out.println("Do you want to continue? [y/n] : ");
k=sc.next();
}
}
private static String decrypt(String ciphertext,int shift)
{
4
String decryptMessage = "";
for(int i=0; i < ciphertext.length();i++)
{
// Shift one character at a time
char alphabet = ciphertext.charAt(i);
// if alphabet lies between a and z
if(alphabet >= 'a' && alphabet <= 'z')
{
// shift alphabet
alphabet = (char) (alphabet - shift);
5
alphabet = plaintext.charAt(i);
}
return ciphertext;
}
}
6
8.0 Output:
7
9.0 Skills Developed
• During the course of developing this micro-project we learnt many practical applications of
Cryptography concepts in theory and practical.
• We learnt to Implement Modifier Caesar’s Cipher with shift of any key.
• We also learnt how to develop, compile and execute code for cryptographic techniques in Java.
The Caesar Cipher Cryptographic Technique finds its application in the following situations:
9
11.0 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
12.0 Reference:
▪ Book: -
▪ Website: -
• https://youtu.be/uDgPgMx0_1s
• https://youtu.be/ywwT8_zOJ-Q
• https://www.geeksforgeeks.org/caesar-cipher-in-cryptography/amp/
• https://cryptii.com/pipes/caesar-cipher