You are on page 1of 12

Government Polytechnic, Washim

MICRO PROJECT REPORT ON

"Implement modifier caesar’s cipher with shift of any key”


OF

Subject: NETWORK & INFOTMATION SECURITY [22620]

Submitted By

KUNAL THER (Enrollment No.2000310257)

Subject Teacher H.O.D.

Mrs. N. S. Mohokar Mr. U. A. Bagade

Lecturer in Info. Tech. Department Information Technology Department

Principal

Dr. B. G. Gawalwad

Government Polytechnic, Washim

i
Government Polytechnic ,Washim

CERTIFICATE

KUNAL THER (Enrollment No.2000310257)

Student of Information Technology has submitted a MICRO PROJECT report on

"Implement modifier caesar’s cipher with shift of any key”

During the academic session 2022-2023 in a satisfactory manner in the partial fulfillmentfor the
requirement of Subject: Network &Information Security[22620]

for the Diploma in “Information Technology”

awarded by

Maharashtra State Board of Technical Education, Mumbai.

Subject Teacher H.O.D

M. N. S. Mohokar Mr. U. A. Bagade

Lecturer in Info. Tech. Department Information Technology Department

Principal
Dr. B. G. Gawalwad

Government Polytechnic, Washim

DEPARTMENT OF INFORMATION TECHNOLOGY


2022-2023

ii
INDEX
SR NO CONTENTS PAGE NO

1 Rationale 1

2 Aim of the Micro-Project 1

3 Course Outcomes Addressed 1

4 Literature Review 2

5 Actual Methodology Followed 3

6 Actual Resources Used 3


7 Source Code 4
8 Outputs of Micro project 7

9 Skill Developed 8

10 Applications of Micro Project 8

11 Conclusion & Reference 9

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.

2.0 Aim of the Micro-Project

This Micro-Project aims at Implement Modifier Caesar’s Cipher with shift of any key.

3.0 Course Outcomes Addressed


c) Apply Cryptographic Algorithms and Protocol to maintain computer security.

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!

The cipher only encrypts letters; symbols, numbers remain unencrypted.


Caesar Cipher is an encryption algorithm in which each alphabet present in plain text is replaced by
alphabet some fixed number of positions down to it. Take below example.
Plain Text: ABCD
Key: 3
Cipher Text (Encrypted Message): DEFG
As key is 3 so each alphabet will be replaced by an alphabet 3 places down to it.

Fig.1. Caesar’s Cipher

2
To decrypt a cipher text, the reverse of encryption process is followed.

Advantages:

1. Simple and Easy to implement.

2. Uses a single Key.

3. Requires very few system resources.

Disadvantages:

1. Minimum Security.

2. Frequency of letter pattern gives out the clue in deciphering the message.

5.0 Actual Methodology Followed


The project aims at Implement Modifier Caesar’s Cipher with shift of any key.
STEP I: Study the concepts of Cryptography-Caesar’s Cipher.
STEP II: Identify requirements of the project
STEP III: Design the structure of project.
STEP IV: Construct the code in Java using Notepad
STEP V: Debug the code and eliminate errors occurred during compilation and execution.
STEP VI: Test the working of project.
STEP VII: Prepare the final report.

6.0 Resources Required

S. No. Resources required Specifications


1 Computer system Pentium Intel(R) CPU, RAM 2.50 GB

2 Operating System Windows 7, 32 Bit Operating System


3 Java jdk1.8.0_211, jre1.8.0_221

3
7.0 Outputs of Micro-project

7.1 Source Code:

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);

// shift alphabet lesser than 'a'


if(alphabet < 'a') {
//reshift to starting position
alphabet = (char) (alphabet-'a'+'z'+1);
}
decryptMessage = decryptMessage + alphabet;
}
// if alphabet lies between A and Z
else if(alphabet >= 'A' && alphabet <= 'Z')
{
// shift alphabet
alphabet = (char) (alphabet - shift);

//shift alphabet lesser than 'A'


if (alphabet < 'A') {
// reshift to starting position
alphabet = (char) (alphabet-'A'+'Z'+1);
}
decryptMessage = decryptMessage + alphabet;
}
else
{
decryptMessage = decryptMessage + alphabet;
}
}
return decryptMessage;
}
private static String encrypt(String plaintext,int shift)
{
char alphabet;
String ciphertext = "";
for(int i=0; i < plaintext.length();i++)
{
// Shift one character at a time

5
alphabet = plaintext.charAt(i);

// if alphabet lies between a and z


if(alphabet >= 'a' && alphabet <= 'z')
{
// shift alphabet
alphabet = (char) (alphabet + shift);
// if shift alphabet greater than 'z'
if(alphabet > 'z') {
// reshift to starting position
alphabet = (char) (alphabet+'a'-'z'-1);
}
ciphertext = ciphertext + alphabet;
}

// if alphabet lies between 'A'and 'Z'


else if(alphabet >= 'A' && alphabet <= 'Z') {
// shift alphabet
alphabet = (char) (alphabet + shift);

// if shift alphabet greater than 'Z'


if(alphabet > 'Z') {
//reshift to starting position
alphabet = (char) (alphabet+'A'-'Z'-1);
}
ciphertext = ciphertext + alphabet;
}
else {
ciphertext = ciphertext + alphabet;
}

}
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.

10.0Applications of this Micro-project

The Caesar Cipher Cryptographic Technique finds its application in the following situations:

• Used to achieve Integrity.


• Used to save the important message or data from the attackers.
• Used to achieve Confidentiality.
• Used to do secure Communication.

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: -

• CRYPTOGRAPHY & NETWORK SECURITY Book by: Atul Kahate


• NIRALI PUBLICATION.
• TECHKNOWLEDGE PUBLICATION

▪ 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

You might also like