Sie sind auf Seite 1von 6

Shift Keyed Caesarean Cryptosystem

Amir Izzat bin Mohd Zin, Muhammad Khairul Azri bin Kamal, Wan Mohd Nasri bin Wan Muhamad Saidin
Departmen of Computer System and Communication,Universiti Teknologi Malaysia
81310 Skudai, Malaysia
amirizzatzin@gmail.com
muhammadkhairulazri@gmail.com
wanmohdnasri@gmail.com

Abstract— This document contains the design of a simple II. DESIGN OF THE ALGORITHM
encryption algorithm named Shift Keyed Caesarean
cryptosystem. A shift keyed Caesarean cryptosystem is a hybrid
between two classical ciphers which are the Shift Caesarean This algorithm can be separated into two modules during
cipher(Substitution Caesar cipher) and Keyed Caesarean cipher. the encryption and decryption process, which are the standard
This document explained the design, implementation and the Shift Caesarean cipher (Substitution Caesar cipher) and Keyed
testing phases of the cryptosystem. Caesar Cipher. We use CrypTool2 to understand and illustrate
the flow of each cipher (module) works.
Keywords— cryptosystem, classical cipher, encryption,
decryption, classical ciphers, shift caesarean cipher, keyed MODULE 1: Caesar Cipher
caesarean cipher.

I. INTRODUCTION

Caesar cipher, also known as a Caesar's cipher, the shift


cipher, Caesar's code or Caesar shift, is one of the simplest
and most widely known encryption techniques that have been
recorded in the history of cryptography. The Caesar cipher is
named after Julius Caesar, a Roman’s emperor where he used Figure 1: Caesar Cipher
it to communicate with his general’s. During the war he used
it as a way to protect messages for the sake of military
significance. It is a type of substitution cipher in which each The Caesar encryption algorithm uses one character from
letter in the plaintext is replaced by a letter of some fixed the alphabet as key. Depending on the position of this key
number of positions down the alphabet. For example, with a letter, the letters of the plaintext are shifted in repeated cycles.
shift of 4, A would be replaced by E, B would become F, and If the alphabet consists only of upper case letters (this is the
so on. [1] default case), a cyclical shift of one character takes place
when "B" is entered, two characters for "C", .... and 25
Another variation to the standard Caesar cipher is known as characters for "Z". To decrypt the text, each encrypted letter is
the “Keyed Caesar Cipher”. In this cryptosystem the alphabet simply shifted in the other direction.[3]
is "keyed" by using a word determined by the sender. In the
traditional variety, one could write the alphabet on two strips
and just match up the strips after sliding the bottom strip to the
left or right. To encode, you would find a letter in the top row
and substitute it for the letter in the bottom row. While for a
keyed version, one would not use a standard alphabet, but
would first write a word (omitting duplicated letters) and then
write the remaining letters of the alphabet.[2]

In this document, the combination between the standard


Caesarean cipher (Substitution Caesar Cipher) and the Keyed
Caesar Cipher will be implemented in hope to produce a better
cryptosystem which will be known as the Shift Keyed
Caesarean Cryptosystem. Figure 2: Shifted Plaintext
MODULE 2: Keyed Caesar Cipher

Figure 3: Keyed Caesar Cipher

Figure 5 : Decryption Process


Another variation to the standard Caesar cipher is known
as the “Keyed Caesar Cipher”. In this cryptosystem the
alphabet is "keyed" by using a word determined by the sender.
The sender would not use a standard alphabet, but would first
write a word (omitting duplicated letters) and then write the III. IMPLEMENTATION OF ALGORITHM
remaining letters of the alphabet.For the example, we used a
key of "azri happy" and you will see that the space is removed
because it is not a letter. You will also notice the letter of “a” This section contains the description out how the modules
and “p” was only included once in the keyed table as duplicate are implemented in C# programming language.
letters were being omitted. [2]

Example Alphabets, No Shift Encryption Caesar Cipher


ABCDEFGHIJKLMNOPQRSTUVWXYZ
Standard ABCDEFGHIJKLMNOPQRSTUVWXYZ for (int a = 0; a <= Enterletter.Length - 1; a++)
{
ABCDEFGHIJKLMNOPQRSTUVWXYZ for (int = 0; b <= storeletter.Length - 1; b++)
Keyed azrihpyBCDEFGJKLMNOQSTUVWX {
if (Enterletter[a] == storeletter[b])
This cipher module will let you specify the keyword that {
will be used at the beginning of the alphabet and will also let lettere = b;
int c = (lettere + k1)%26;
you shift the keyed alphabet around just like the normal
Caesar cipher temp1 += storeletter[c].ToString();
}
The decryption process of this algorithm is the reversal of }
encryption process explained above. Diagrams below might }
help you to understand the whole concept of this algorithm.
A. Encryption Keyed Caesar Cipher

for (int d = 0; d <= temp1.Length - 1; d++)


{
for (int i = 0; i <= storeletter.Length - 1; i++)
{
if (temp1[d] == storeletter[i])
{
lettere = i;
int f = (lettere + k2) % 26;

temp2 += storeletter[f].ToString();
}
}
}
Figure 4: Encryption Process
for (int g = 0; g <= temp2.Length - 1; g++)
{
for (int h=0;h <= storeletter.Length - 1; h++)
{ IV. RESULT
if (temp2[g] == storeletter[h])
{
lettere = h;
temp3 += letter[h]; A. Test 1
}
} Key 1: 2
} Key 2: 2
Substitution Key: CIPHER
CIPHERABDFGJKLMNOQSTUVWXYZ
B. Decryption Keyed Caesar Cipher

for (int g = 0; g <= Enterletter.Length - 1; g++) 1) Encryption


{ Plaintext:
for (int h = 0; h <= letter.Length - 1; h++)
gaius julius caesar was a roman general and
{
if (Enterletter[g] == letter[h])
statesman he played a critical role in the
{ transformation of the roman republic into the roman
lettere = h; empire
temp1 += storeletter[h];
} Corresponding ciphertext:
} GEKYWLYNKYWAEDWEVCEWEVSOEQGDQ
} DVENEQBWXEXDWOEQJDTNEPDBEAVKXKA
ENVSNDKQXJDXVEQWFSVOEXKSQSFXJDVS
for (int a = 0; a <= temp1.Length - 1; a++) OEQVDTYRNKAKQXSXJDVSOEQDOTKVD
{
for (int b=0; b <= storeletter.Length - 1; b++)
{ 2) Decryption
if (temp1[a] == storeletter[b]) Ciphertext:
{ GEKYWLYNKYWAEDWEVCEWEVSOEQGDQ
lettere = b; DVENEQBWXEXDWOEQJDTNEPDBEAVKXKA
int c = (lettere + k2)%26; ENVSNDKQXJDXVEQWFSVOEXKSQSFXJDVS
OEQVDTYRNKAKQXSXJDVSOEQDOTKVD
temp2 += storeletter[c].ToString();
} Corresponding plaintext:
}
}
gaiusjuliuscaesarwasaromangeneralandstatesmanhepl
ayedacriticalroleinthetransformationoftheromanrepub
licintotheromanempire
C. Encryption Caesar Cipher

for (int d = 0; d <= temp2.Length - 1; d++)


{ B. Test 2
for (int i = 0; i <= storeletter.Length - 1; i++)
{ Key 1: 3
if (temp2[d] == storeletter[i]) Key 2: 11
{ Substitution Key: SECRET
lettere = i; SECRTABDFGHIJKLMNOPQUVWXYZ
int f = (lettere + k1) % 26;

temp3 += storeletter[f].ToString();
} 1) Encryption
} Plaintext:
} the roman republic was governed by a complex
constitution, which centered on the principles of a
separation of powers and checks and balances

Corresponding ciphertext:
DVPACSLEAPRFMZWNHLBUCGPAEPOMJLNC
SRZPINCEBDWDFDWCEHVWNVNPEDPAPOC
EDVPRAWENWRZPBCQLBPRLALDWCECQRC
HPABLEONVPNYBLEOMLZLENPB
illustration of each cipher (module) flow to make it easier for
2) Decryption the user to understand the concept of the cryptosystem. We
Ciphertext: also demonstrated the cryptosystem by giving the input and
DVPACSLEAPRFMZWNHLBUCGPAEPOMJLNC the output of three testing of the cryptosystem. Hence, we
SRZPINCEBDWDFDWCEHVWNVNPEDPAPOC hope the proposed cryptosystem can be used in the real
EDVPRAWENWRZPBCQLBPRLALDWCECQRC environment of a simple messages encryption and decryption
HPABLEONVPNYBLEOMLZLENPB process.

Corresponding plaintext: REFERENCES


theromanrepublicwasgovernedbyacomplexconstitutio
nwhichcenteredontheprinciplesofaseparationofpower [1] http://en.wikipedia.org/wiki/Caesar_cipher.
sandchecksandbalances [2] http://rumkin.com/tools/cipher/caesar-keyed.php
[3] http://rumkin.com/tools/cipher/caesar

C. Test 3
APPENDIX
Key 1: 20
Key 2: 6 A. Source Code
Substitution Key: CRYPTO
CRYPTOABDEFGHIJKLMNQSUVWXZ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
3) Encryption using System.Drawing;
Plaintext: using System.Linq;
caesar is sometimes thought to have suffered from using System.Text;
epilepsy modern scholars is sharply divided on the using System.Windows.Forms;
subject and it is more certain that he was plagued by
malaria namespace WindowsFormsApplication4
{
public partial class Form1 : Form
Corresponding ciphertext:
{
YCTNCMDNNJHTQDHTNQBJSABQQJBCUTNS public Form1()
OOTMTPOMJHTKDGTKNXHJPTMINYBJGCMN {
DNNBCMKGXPDUDPTPJIQBTNSRETYQCIPDQ InitializeComponent();
DNHJMTYTMQCDIQBCQBTVCNKGCASTPRX }
HCGCMDC
private int ToDecimal(int ky1)
4) Decryption {
Ciphertext: throw new NotImplementedException();
}
YCTNCMDNNJHTQDHTNQBJSABQQJBCUTNS
int k01, k02 = 0;
OOTMTPOMJHTKDGTKNXHJPTMINYBJGCMN private void button1_Click(object sender, EventArgs e)
DNNBCMKGXPDUDPTPJIQBTNSRETYQCIPDQ {
DNHJMTYTMQCDIQBCQBTVCNKGCASTPRX char[] storeletter = new char[26] { 'a', 'b', 'c', 'd', 'e', 'f',
HCGCMDC 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
'z' };
Corresponding plaintext: char[] newletter = new char[26];
Caesarissometimesthoughttohavesufferedfromepileps int k1 = k01;
ymodernscholarsissharplydividedonthesubjectanditis int k2 = k02;
int lettere = 0;
morecertainthathewasplaguedbymalaria
string temp1 = string.Empty;
string temp2 = string.Empty;
string temp3 = string.Empty;
string Enterletter = string.Empty;
V. CONCLUSIONS string letter = phrase.Text;
Enterletter = encrypt.Text;
In this paper, we have proposed a new cryptosystem named
“Shift Keyed Caesarean cryptosystem” to be implemented for
for (int a = 0; a <= Enterletter.Length - 1; a++)
a simple message encryption. We presented the design and the
{
for (int b = 0; b <= storeletter.Length - 1; b++) string temp1 = string.Empty;
{ string temp2 = string.Empty;
if (Enterletter[a] == storeletter[b]) string temp3 = string.Empty;
{ string Enterletter = string.Empty;
lettere = b; string letter = phrase.Text;
int c = (lettere + k1)%26; Enterletter = encrypt.Text;

temp1 += storeletter[c].ToString();
} for (int g = 0; g <= Enterletter.Length - 1; g++)
} {
} for (int h = 0; h <= letter.Length - 1; h++)
{
for (int d = 0; d <= temp1.Length - 1; d++) if (Enterletter[g] == letter[h])
{ {
for (int i = 0; i <= storeletter.Length - 1; i++) lettere = h;
{ temp1 += storeletter[h];
if (temp1[d] == storeletter[i]) }
{ }
lettere = i; }
int f = (lettere + k2) % 26;

temp2 += storeletter[f].ToString();
} for (int a = 0; a <= temp1.Length - 1; a++)
} {
} for (int b = 0; b <= storeletter.Length - 1; b++)
{
for (int g = 0; g <= temp2.Length - 1; g++) if (temp1[a] == storeletter[b])
{ {
for (int h = 0; h <= storeletter.Length - 1; h++) lettere = b;
{ int c = (lettere + k2)%26;
if (temp2[g] == storeletter[h])
{ temp2 += storeletter[c].ToString();
lettere = h; }
temp3 += letter[h]; }
} }
}
} for (int d = 0; d <= temp2.Length - 1; d++)
{
result.AppendText(temp3); for (int i = 0; i <= storeletter.Length - 1; i++)
} {
if (temp2[d] == storeletter[i])
private void textBox1_TextChanged(object sender, {
EventArgs e) lettere = i;
{ int f = (lettere + k1) % 26;
string num = textBox1.Text;
k01 = int.Parse(num); temp3 += storeletter[f].ToString();
} }
}
private void textBox2_TextChanged(object sender, }
EventArgs e)
{
string num = textBox2.Text; result.AppendText(temp3);
k02 = int.Parse(num); }
}
}
private void button2_Click(object sender, EventArgs e) }
{
char[] storeletter = new char[26] { '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' };
char[] newletter = new char[26];
int k1 = 26-k01;
int k2 = 26-k02;
int lettere = 0;
B. Interfaces

Figure 6: Encryption Figure 7: Decryption

Das könnte Ihnen auch gefallen