lecture 3

55
Lecture 3 Lecture 3 1

Upload: jonah-bentley

Post on 31-Dec-2015

43 views

Category:

Documents


0 download

DESCRIPTION

Lecture 3. Transposition Ciphers. Transposition Ciphers. now consider classical transposition or permutation ciphers these hide the message by rearranging the letter order without altering the actual letters used - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lecture 3

Lecture 3Lecture 3

1

Page 2: Lecture 3

TRANSPOSITION CIPHERSTRANSPOSITION CIPHERS

2

Page 3: Lecture 3

Transposition CiphersTransposition Ciphersnow consider classical transposition or permutation ciphers

these hide the message by rearranging the letter order

without altering the actual letters used

can recognise these since have the same frequency distribution as the original text

3

Page 4: Lecture 3

Rail Fence cipherRail Fence cipherwrite message letters out diagonally

over a number of rows then read off cipher row by roweg. write message out as:

m e m a t r h t g p r y e t e f e t e o a a t

giving ciphertextMEMATRHTGPRYETEFETEOAAT

4

Page 5: Lecture 3

Decryption of Rail FenceDecryption of Rail FenceDivide the statement by 2 If odd number let the first part is

more than 1Put he first part aboveAnd the second part belowRead the statement as diagonal

5

Page 6: Lecture 3

Reverse cipherReverse cipher

Write the message backwardsEx:Plain: I came I saw I conq

uered Cipher: d ereu q noci w asie

maci

6

Page 7: Lecture 3

Decryption of Reverse Decryption of Reverse ciphercipherWrite the cipher message

backwards

7

Page 8: Lecture 3

Row Transposition CiphersRow Transposition Ciphersa more complex transpositionwrite letters of message out in

rows over a specified number of columns (key length)

Then reorder the columns according to some key before reading off the rows

Key : 41532Plain text : the simplest possible transpositions.

8

Page 9: Lecture 3

Row Transposition CiphersRow Transposition CiphersMake the statement in 5 columns:“the simplest possible transpositions”

9

1 2 3 4 5T H E S I

M P L E S

T P O S S

I B L E T

R A N S P

O S I T I

O N S X X

Page 10: Lecture 3

Row Transposition CiphersRow Transposition Ciphers

10

1 2 3 4 5T H E S I

M P L E S

T P O S S

I B L E T

R A N S P

O S I T I

O N S X X

4 1 5 3 2S T I E H

E M S L P

S T S O P

E I T L B

S R P N A

T O I I S

X O X S N

Page 11: Lecture 3

Row Transposition CiphersRow Transposition CiphersMake the statement in 5 columns:

11

Key: 41532

Cipher: STIEH EMSLP STSOP EITLB SRPNA TOIIS XOXSN

4 1 5 3 2S T I E H

E M S L P

S T S O P

E I T L B

S R P N A

T O I I S

X O X S N

Page 12: Lecture 3

The same plain with The same plain with another keyanother key

1 2 3 4 5

T H E S I

M P L E S

T P O S S

I B L E T

R A N S P

O S I T I

O N S X X

12

1 5 3 4 2

T I E S H

M S L E P

T S O S P

I T L E B

R P N S A

O I I T S

O X S X N

The key : 15342The cipher is :TIESH MSLEP TSOSP ITLEB RPNSA OIITS OXSXN

Page 13: Lecture 3

Row transposition : Row transposition : Example 1Example 1Plain text : " laser beams can be

modulated to carry more intelligence than radio”

Key is: 6 3 4 1 2 5 7

13

Page 14: Lecture 3

Row transposition : Row transposition : Example 1Example 1

" laser beams can be modulated to carry more intelligence than radio”

14

1 2 3 4 5 6 7L A S E R B E

A M S C A N B

E M O D U L A

T E D T O C A

R R Y M O R E

I N T E L L I

G E N C E T H

A N R A D I O

Page 15: Lecture 3

Row transposition : Row transposition : Example 1Example 1

KEY : 6 3 4 1 2 5 7

15

1 2 3 4 5 6 7L A S E R B E

A M S C A N B

E M O D U L A

T E D T O C A

R R Y M O R E

I N T E L L I

G E N C E T H

A N R A D I O

6 3 4 1 2 5 7

B S E L A R E

N S C A M A B

L O D E M U A

C D T T E O A

R Y M R R O E

L T E I N L I

T N C G E E H

I R A A N D O

Page 16: Lecture 3

Row transposition : Row transposition : Example 1Example 1

Solution is : “bselare nscamab lodemua

cdtteoa rymrroe lteinli tncg eeh iraando”

16

6 3 4 1 2 5 7

B S E L A R E

N S C A M A B

L O D E M U A

C D T T E O A

R Y M R R O E

L T E I N L I

T N C G E E H

I R A A N D O

Page 17: Lecture 3

Another ExampleAnother Example: : 22Let key : COMPUTERPLAIN: “a convenient way to express the

permutation “

17

Page 18: Lecture 3

Another ExampleAnother ExampleLet key : COMPUTERKey will be:

18

C O M P U T E R

1 4 3 5 8 7 2 6

Page 19: Lecture 3

Another ExampleAnother Example

19

Key: 14358726Plain: a convenient way to the permutation Cipher: ANOVINCE EW TAOTNY TPEEUMHR TITOXXAN

1 2 3 4 5 6 7 8A C O N V E N I

E N T W A Y T O

T H E P E R M U

T A T I O N X X

1 4 3 5 8 7 2 6A N O V I N C E

E W T A O T N Y

T P E E U M H R

T I T O X X A N

Page 20: Lecture 3

Row Transposition CiphersRow Transposition Ciphersa more complex transpositionwrite letters of message out in rows

over a specified number of columnsthen reorder the columns according

to some key before reading off the rowsKey: 3 4 2 1 5 6 7Plaintext: a t t a c k p o s t p o n e d u n t i l t w o a m x y zCiphertext: TTNAAPTMTSUOAODWCOIXKNLYPETZ

20

Page 21: Lecture 3

Decryption of a Row Decryption of a Row Transposition cipherTransposition cipherconsists of:writing the message out in rowsreading off the message by reordering columns

21

Page 22: Lecture 3

CIPHER TEXT : LHEL VOEE BRYOXDYX

THE solution : hello every body

22

3 1 2 4L H E L

V O E E

B R Y O

X D Y X

Page 23: Lecture 3

Decryption of a Row Decryption of a Row Transposition cipher Transposition cipher example:example:Cipher text = OANTTOSRGINCHRPE

Key:

IVAN

23

Page 24: Lecture 3

The solution is : not a strong cipher

24

Page 25: Lecture 3

Product CiphersProduct Ciphersciphers using substitutions or

transpositions are not secure because of language characteristics

hence consider using several ciphers in succession to make harder: ◦ two substitutions make a more complex

substitution ◦ two transpositions make more complex

transposition ◦ but a substitution followed by a transposition

makes a new much harder cipher this is bridge from classical to modern

ciphers

25

Page 26: Lecture 3

Product CiphersProduct Ciphersbefore modern ciphers, rotor machines

were most common product cipherwere widely used in WW2

◦German Enigmaimplemented a very complex, varying

substitution cipherused a series of cylinders, each giving

one substitution, which rotated and changed after each letter was encrypted

with 3 cylinders have 263 =17576 alphabets

26

Page 27: Lecture 3

Block CiphersBlock CiphersDr. Nermin HamzaDr. Nermin Hamza

27

Page 28: Lecture 3

Modern Cryptographic Modern Cryptographic TechniquesTechniquesModern cipher system :

◦Symmetric ◦Asymmetric

Symmetric cryptography:◦Stream cipher◦Block cipher

28

Page 29: Lecture 3

Modern Cryptographic Modern Cryptographic TechniquesTechniques

29

Page 30: Lecture 3

Stream cipherStream cipherStream ciphers: where plaintext

bits are combined with a pseudorandom cipher bit stream (key stream), typically by an

exclusive-or (xor) operation. In a stream cipher, the plaintext digits are encrypted one at a time, and the transformation of successive digits varies during the encryption.

30

Page 31: Lecture 3

Stream cipherStream cipher

31

Stream ciphers:- process messages a bit or byte at a time when en/decrypting

Page 32: Lecture 3

Stream cipherStream cipher

32

2 types:◦Synchronous stream ◦Asynchronous stream

Synchronous stream ciphers where the key stream depends only on the key,

Asynchronous stream ones where the key stream also depends on the ciphertext.

Page 33: Lecture 3

Stream cipherStream cipher

33

Page 34: Lecture 3

Stream cipherStream cipher

34

Definition Stream Cipher Encryption and Decryption

The plaintext, the ciphertext and the key stream consist of individual bits, i.e., xi,yi, si ∈ {0,1}.

Encryption: yi = esi (xi) ≡ xi+si mod 2.Decryption: xi = dsi (yi) ≡ yi+si mod 2.

Page 35: Lecture 3

Modern Block CiphersModern Block Cipherslook at modern block ciphersone of the most widely used types

of cryptographic algorithms provide secrecy /authentication

servicesfocus on DES (Data Encryption

Standard)to illustrate block cipher design

principles

35

Page 36: Lecture 3

Block cipherBlock cipher

36

Block cipher scheme :encrypts one block of data at a time using the same key on each block.• In general, the same plaintext block will always be encrypted to the same cipher text if using the same key in a block cipher whereas the same plaintext will be encrypted to different cipher text in a stream cipher.

Page 37: Lecture 3

Block cipherBlock cipher block ciphers: process messages in

blocks, each of which is then en/decrypted like a substitution on very big characters

◦64-bits or more

37

Page 38: Lecture 3

Block modesBlock modesElectronic Codebook (ECB) mode

Cipher Block Chaining (CBC) mode

Cipher Feedback (CFB) Output Feedback (OFB) mode

38

Page 39: Lecture 3

Block modesBlock modesElectronic Codebook (ECB) mode:The simplicity of the encryption modes is the electronic codebook (ECB) mode, in which the message is split into blocks and each is encrypted separately

39

Page 40: Lecture 3

Block modesBlock modes

40

Page 41: Lecture 3

Block modesBlock modes

Cipher Block Chaining (CBC) mode In the cipher-block chaining (CBC) mode, each block of the plaintext is XORed with the previous cipher text block before being encrypted. This way, each cipher text block is dependent on all plaintext blocks up to that point.

41

Page 42: Lecture 3

Block modesBlock modes

42

Page 43: Lecture 3

Block modesBlock modes

43

Page 44: Lecture 3

Block modesBlock modes

Cipher Block Chaining (CBC) mode

44

Page 45: Lecture 3

Block modesBlock modes

Cipher Feedback (CFB) Cipher feedback mode converts the block cipher into a stream cipher: they generate key-stream blocks, which then are XORed with the plaintext blocks to get the cipher-text. Just as with other stream ciphers, flipping a bit in the cipher-text produces a flipped bit in the plaintext at the same location. With cipher feedback, a key-stream block is computed by encrypting the previous cipher-text block.

45

Page 46: Lecture 3

Block modesBlock modes

46

Page 47: Lecture 3

Block modesBlock modes

47

Page 48: Lecture 3

Block modesBlock modes Cipher Feedback (CFB)

48

Page 49: Lecture 3

Block modesBlock modesOutput Feedback (OFB) modeOFB is similar to CFB but with small differences, where the Output feedback generates the next key-stream block by encrypting the last one.

49

Page 50: Lecture 3

Block modesBlock modes

50

Page 51: Lecture 3

Block modesBlock modes

51

Page 52: Lecture 3

Block modesBlock modes Output Feedback (OFB) mode

52

Page 53: Lecture 3

Block vs Stream CiphersBlock vs Stream Ciphersmany current ciphers are block

ciphersbroader range of applications

53

Page 54: Lecture 3

Block vs Stream CiphersBlock vs Stream CiphersBlock ciphers work a on block / word at a time, which is some number of bits. All of these bits have to be available before the block can be processed.

Stream ciphers work on a bit or byte of the message at a time, hence process it as a “stream”.

Block ciphers are currently better analysed, and seem to have a broader range of applications, hence focus on them.

54

Page 55: Lecture 3

Write a program for encrypt or / Decryption using Row transposition

55