DATA SECURITY
3rd Class
CIPHER SYSTEMS
• There are two types of ciphers:-
• Transpositions Ciphers (Reorder the letters).
• Substitution Cipher (Disguise the letters).
Transpositions Ciphers
1- Message Reversal :
• Writing the plaintext in the reversal form to
get the cipher text.
• Ex:
• Plaintext: MEET ME MONDAY MORNIING
• Cipher: GNIGROM YADNOM EM TEEM
• It is easy and direct method.
Transpositions Ciphers
2- Geometrical Patterns:
Change the ordinary geometrical pattern of
English writing to a different geometrical
pattern using a certain key.
Ex: Conceal all messages
9*2 6*3
Concealal concea
lmessages lallme
ssages
Transpositions Ciphers
3- Rotate Transposition:
• Zig-Zag (Rail fence):
In this method, The plaintext divided into fixed lengths.
one length contains every even positioned letter of
the
message. The transposing process follow this type of
pattern(zig zag).
Ex: Let, the plain text: SEND HELP SOON, and depth=2 find
cipher text:
Transpositions Ciphers
• Reversal Zig-Zag .
The enciphering starts with the last letter of the
plain text and continues back to the beginning of
the message first the odd positioned letters are
taken and then even positioned ones.
EX: Let, the plain text: SEND HELP SOON
the cipher text is : NOPEDEOSLHNS
Transpositions Ciphers
4- Rotate Variations:
It can go in many different directions:
1.Horizontal Rotate.
Transpositions Ciphers
2. Vertical Rotates.
Transpositions Ciphers
3. Diagonal Rotates.
Transpositions Ciphers
4. Clockwise Rotates.
5. Anticlockwise Rotates.
Transpositions Ciphers
5. Columnar Transposition:
Generally the plaintext is ordered in rows (rectangular
geometrical patterns) under the key which numbers
so formed.
The cipher text is then read by columns, starting with
column whose number is the lowest as shown in the
example below.
Transpositions Ciphers
EX:
Plaintext: This is an example of a simple transposition
cipher.
Key word: 3276451
Cipher Text:
almniefheolpnatnepsorimsripdspiathesaatsicixfeocb
Transpositions Ciphers
An alternative approach is to use a specified
word as a key, such as ASCII code.
• Keywords as ASCII values:
ASCII is introduced in 1967 by ANSI(American
National Standards Institute ), ASCII means
(American Standard Code for Information
Interchange).
Transpositions Ciphers
Example on the use of ASCII values as keyword.
Keyword: FIGHT
Column position: 1 4 2 3 5
Finally, we can use our addresses or telephone
numbers or birthdates as a Keywords.
6. Other Transposition:
i. Double Columnar Transposition: this technique used to cipher
the output cipher text of columnar transposition using
another different key.
• Ex: negotiations stalled send instructions today.
Therefore the cipher text sent in the form of a group of four :
Netn snie sdog tino anst lsti ltoa erdt duai scyo
6. Other Transposition:
ii. Poly literal Transposition: this technique uses two
characters as unit.
• Ex: negotiations stalled send instructions today. Keyword
(LIFE).
• Cipher Text: TIENNS NEONOI STGOST NSALTI ODTRLE ATAYUC
DSIOXY
• Note: the last two characters XY are add to balance the
group of six characters.
6. Other Transposition:
• iii. Code Word Transposition:
• Code Word.
• Transposition.
• Let the plain text given the above example is coded
as follows:
negotiations stalled send instruction today
Kewb mlma lsrb Jmxy mnbb
The code words are divided from a codebook.
6. Other Transposition:
The code words now can be ciphered using polyliteral
transposition as follows:
The key Word (8 1 1978) will be (3 1 5 2 4) number 8 is
repeated twice, the left will be less than right one.
Cipher Text: Iske nmmi jmrb wbbb maxy
Substitution Cipher Methods
Substitution Cipher:
Each letter or group of letters is replaced by another
letter or group to disguise (camouflage) it.
In its simplest form, a becomes d, b becomes e, c
becomes f, etc.
More complex substitution can be devised e.g.
a random (or key controlled) mapping of one letter to
another.
Substitution Cipher Methods
• Number cipher
It is simple and direct method which replaces 26
English alphabetic characters by number, such as
a is one b is the second … etc.
Example:
Plain text: think security
Cipher text: 20 3 9 14 11 19 5 3 21 18 9 20 25
• A number cipher gives very low security.
Substitution Cipher Methods
• ASCII cipher system
Each character is substituted by its equivalent ASCII
value.
C = P + (96 for small letter or 64 for capital letter)
P = C - (96 for small letter or 64 for capital letter)
Ex:
Plain text: SECRET
Cipher text: 83 69 67 82 69 84
Substitution Cipher Methods
• Reciprocal ciphers :
It is possible to cipher a text by replacing each
character in the text by its reciprocal. In the ciphers
the letter A replaces Z, the letter Y replaces B … etc.
Substitution Cipher Methods
character (reciprocal) can be calculated using:
1-Character alphabetic number:
C=27-P (Cipher)
P=27-C (Decipher)
• Ex:
Plain text: send help soon
Cipher text: hvmw svok hllm
Substitution Cipher Methods
2- Character ASCII Value.
For capital letter:
C = 90 – P+65 (Cipher)
P = 90 – C +65 (Decipher)
For small letter:
C = 122 – P+97 (Cipher)
P = 122 – C +97 (Decipher)
• Ex:
Plain text: send help soon
Cipher text: hvmw svok hllm
Substitution Cipher Methods
Morse code cipher:
It is a means of representing letters as a sequence of
dots (.) and dashes (-), used with telegraphs.
When Morse code used for encryption, is represented
as a three symbol coding using the symbol (. , - , |),
dot ,dash and separator.
Substitution Cipher Methods
• To encrypt a message using Morse code,
three steps required :
1-English plaintext is converted to Morse code, using
separator between letters and extra separator
between words.
2-The Morse code message is divided into blocks of
three symbols.
3- Each block is encoded as the letter correspond to
that three symbol pattern.
Substitution Cipher Methods
• Morse Code Map
Substitution Cipher Methods
Example:
The plaintext message: Morse code
• We choose the keyword [Woven flax], so the associated
mapping will be as follows:
• Morse code --|---|.-.|...|.||-.-.|---|-..|.|
• The cipher text message is: IHQLVXCAIBR
Caesar Cipher (seizer Cipher) :
The cipher replaces the plaintext character by a character
three places for in the alphabetic order.
C(i) = P(i) + 3 mod 26
Ex:
Plaintext: secure all message
Cipher text: vhfxuh doo phvvdjhv (k=3)
The shift could be any number from 1 to 26 and this is the
key (k).
Plaintext: 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
Cipher: d e f g h i j k l m n o p q r s t u v w x y z a b c
Substitution Cipher Methods
• Decimated alphabet Cipher:
This method gives more security to Caesar Ciphers.
i. Consecutive sequence (Caesar cipher)
For k = 3 a d
ii. Nonconsecutive sequence for (k=3)
Let :
a: number value of normal alphabet character.
k: key value.
b: k*a/26 (b = k*a/26.1)
c: number value of decimated alphabet character.
Substitution Cipher Methods
Plaintext k*a Cipher
a b = k*a/26.1 c=k*a – b*26
character (k = 3) character
a 1 3 0.1149 3 C
b 2 6 0.2298 6 F
c 3 9 0.3448 9 i
. . . . . .
. . . . . .
. . . . . .
x 24 72 2.7586 20 t
y 25 75 2.8735 23 W
z 26 78 2.9885 26 Z
Substitution Cipher Methods
Ex: Plaintext = double agent , Key=3
d o u b l e a g e n t
a 4 15 21 2 12 5 1 7 5 14 20
k 3 3 3 3 3 3 3 3 3 3 3
b = k*a/26.1 b 0.4 1.7 2.4 0.2 1.3 0.5 0.1 0.8 0.5 1.6 2.2
c=k*a – b*26 c 12 19 11 6 10 15 3 21 15 16 8
L s k f j o c u o p h
Cipher text= Lskfjocuoph
Substitution Cipher Methods
• Key phrase ciphers: in this ciphers the key
takes the form of phrase together with one
extra special letter. The first letter of the
phrase will be the cipher text equivalent of
plaintext special letter.
• Ex:
• Key is (Little Finger), special character is (F)
Plain 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
cipher v w x y z l i t e f n g r a b c d h j k m o p q s u
Substitution Cipher Methods
• Monoalphbetic Ciphers:
• This method uses only one cipher alphabet,
example (Caesar, reciprocal, key phrase,
decimated). Caesar Cipher can generate 25
monoalphbetic substitution alphabet.
Monoalphbetic Ciphers:
Substitution Cipher Methods
• Polyalphabetic Substitution Cipher:
• It uses two or more alphabetic in the
substitution process in order to give a cipher
that is more cryptographically secure than
monolaphabetic ciphers, a well-known
example of a polyalphabetic substitution is the
Vigenere system which was devised in franc in
1548 by Blaise de Vigenere.
Polyalphabetic Substitution Cipher:
• Vigenere Table:-
• Is a collection of 26 substitutions usually these
substitutions are written as 26*26 matrix,
with all 26 letters in each row and each
column. Such as arrangement in show in table
below.
Vigenere Table:-
Polyalphabetic Substitution Cipher
• A useful modification is to use a keyword, and
the letters of the keyword select the columns
for encipherment.
• You would write the message and write on
character of keyword above each message
characters repenting the keyword as often as
necessary.
• C= (p+k) mod 26
Polyalphabetic Substitution Cipher
Ex1:
Plaintext: ATTACKATDAWN
Key : LEMONLEMONLE
Ciphertext:LXFOPVEFRNHR
Ex2:
Plaintext : Carryout plan b Wednesday
Key : endenden ende n dendenden
Ciphertext: gn
Diagraph substitution (Play fair cipher):
The plain text is broken into pairs of characters and
each pair is replaced by a substitution pair to form a
cipher text this cipher uses a sequence of (5X5)
consists of the alphabetic characters located in the
clockwise.
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
In this square the z has been omitted.
Diagraph substitution (Play fair cipher):
Rules of ciphering:
1- If the two characters of the pair are in the same row,
their cipher are equivalent are the characters
immediately to their right.
pair AC cipher BD 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
2- If the plain text characters at the end of the row
ST TP
KO LK
Diagraph substitution (Play fair cipher):
3- If the two characters of pair are in the same column
their cipher equivalent are the characters.
Immediately below each one.
CH HM 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
• If the plaintext letter is at the end of the bottom we
substituted by the letter at the opposite end of the
same column.
IX ND, YE EJ
Diagraph substitution (Play fair cipher):
4- If the two characters are in the opposite corners of
an imaginary rectangular diagram ally opposite each
other, their cipher equivalent are characters of the
opposite diagonal.
Diagraph substitution (Play fair cipher):
Ex:
Keyword: Code c o d e a
b f g h i
j k l m n
p q r s t
u v w x y
• Plain text: Kirkuk University
ki rk uk un iv er si ty
• Cipher text: nf ql vj yj fy ds th ya
Affine Cipher
)Affine cipher =( shift + multiplication
) Shift or Caesar (C = p + key MOD n
) Product or multiplication( C = p * key MOD n
Affine Cipher is C = (m*p + key) MOD n
• مالحظــــــة:
• ھناك شرط مھم جدا ،وھو أن تكون mو nھما أولیان فیما بینھما ،أي
أن القاسم المشترك لـ mو nیساوي . 1وفي حال لم ینفذ ھذا الشرط ،
فانه النستطیع فك التشفیر.
• لفك التشفیر یجب أن نوجد معكوس .mإذا وجدنا أن GCD(m,n) = 1
من ثم نستخدم القانون التالي لفك التشفیر
)p = m` * (c - key) (mod n
Affine Cipher
Ex: plaintext= WAR LOST , key=10 ,m=7
Encryption:
1- If the Greatest Common Divisor GCD(7,26)=1 we can find
the inverse of m (m`).
2- C = m * p + key MOD 26
C1 = 7 * 22 + 10 MOD 26 = 8
C2 = 7 * 0 + 10 MOD 26 = 10
C3 = 7 * 17 + 10 MOD 26 = 25
C4 = 7 * 11 + 10 MOD 26 = 9
C5 = 7 * 14 + 10 MOD 26 = 4
C6 = 7 * 18 + 10 MOD 26 = 6
C7 = 7 * 19 + 10 MOD 26 = 13
C= 8 10 25 9 4 6 13
Cipher text= IKZJE GN
Affine Cipher
To find the Inverse (m'):
m: is multiplicative Key.
x: is counter from 1 to 27.
m*x mod 26=1 , m‘=x .
For m=7 , m`=15
Computation Cryptography:
• Arithmetic Operations:
• Algebraic Operations:
• Matrix Operations:
3/2/2017 Thursday 50
Computation Cryptography:
• Arithmetic Operations:
arithmetic operations are addition, subtraction, multiplication
and division.
– ASCII value + constant.
– ASCII value - constant.
– ASCII value * constant.
– ASCII value ÷ constant.
– ASCII value ^ constant.
EX: Plain text: CHANGE KEYS TODAY
Cipher = ASCII Value – 50
Cipher = (L + character sequence) – 50
CHANGE : 17 22 15 28 21 19
KEYS :25 19 39 33
TODAY :34 29 18 15 39
Saturday, January 19, 2019
Computation Cryptography:
• Algebraic Operations:
1- Linear Equations:
Ex:
Plain text: CHANGE KEYS TODAY
Y = a + bX let a=2, b=1/2, X= old ASCII value
Y = a + b(ASCII Value)
Y = a + b(L + character sequence)
Cipher text: Y
CHANGE : 35.5 38 34.5 41 37.5 36.5
KEYS : 39.5 36.5 46.5 43.5
TODAY :44 41.5 36 34.5 46.5
Saturday, January 19, 2019
Computation Cryptography:
• Algebraic Operations:
2- Non Linear Equations:
Ex: C
Y = a + bX2 let a = -15, b=2
plaintext C H A N G E
ASCII Value: 67 72 65 78 71 69
X2 4489 5184 4225 6084 5041 4761
Y = -15 + 2x2 8963 10353 8435 12153 10067 9507
Saturday, January 19, 2019
Computation Cryptography:
• Matrix Operations: This method requires to arrange the
plain text in a matrix form the elements of the matrix
substituted by its equivalent ASCII values.
Ex: Plain text= DATA
1-Encryption by matrix multiplication: C = K * V
The cipher text if taken horizontally gives: 136 130 168 130
Saturday, January 19, 2019
Computation Cryptography:
• Matrix Operations:
2- Encryption by matrix transposition: C = VT
The cipher text will be: 68 84 65 65
3- Encryption by matrix inversion: C = V-1
The cipher text: -0.0625 0.625 0.0808 -0.0654
Saturday, January 19, 2019
Matrix Operations:
Two ways to find the inverse of a matrix:
1. Shortcut for 2x2 matrices using determinant:
Saturday, January 19, 2019
Matrix Operations:
2- find inverse for 3x3 matrices :
Ex: find A-1 for .
Step 1: find determined for A.
det = ((1*4*6)+(2*5*1)+(3*0*0))-((3*4*1)+(1*5*0)+(2*0*6))
= (24+10) – 12
=22
Saturday, January 19, 2019
Matrix Operations:
Step 2: find the cofactor of each element.
As a result the cofactor matrix of A is:
Step3: The adjoint of A is the transpose of the cofactor matrix:
Saturday, January 19, 2019
Matrix Operations:
Finally the inverse of A is :
Saturday, January 19, 2019