Professional Documents
Culture Documents
CAESAR CIPHER :-
This scheme first explained and proposed by Julius Caesar, and is termed
Caesar cipher.
It was the first example of substitution cipher. In the substitution-cipher
technique, the characters of a plain-text message are replaced by other
characters, numbers or symbols.
The Caesar cipher is a special case of substitution technique where in
each
alphabet in a message is replaced by an alphabet three places down the
line.
For instance, using the Caesar cipher, the plain-text Rutuja Nachnekar
will become cipher-text
UDKXO1.
Input
public class CeaserCifer {
// Driver code
public static void main(String[] args)
{
String text = "My name is nilam ";
int s = 3;
System.out.println("Text : " + text);
System.out.println("Shift : " + s);
System.out.println("Cipher: " + encrypt(text, s));
}
}
Output
MONOALPHABETIC CIPHER :-
import java.util.Scanner;
public class MonoalphabeticCipher {
public static char p[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z' };
public static char ch[] = { 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O',
'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C',
'V', 'B', 'N', 'M' };
OUTPUT