25
RC5 Algorithm and its use in Image Encryption SURAMRIT SINGH (351/10) ROLL 39

I mage encryption using rc5

Embed Size (px)

Citation preview

Page 1: I mage encryption using rc5

RC5 Algorithm and its use in Image Encryption

SURAMRIT SINGH (351/10)ROLL 39

Page 2: I mage encryption using rc5

RC5-Symmetric Block Cipher• Given by Ronald. L. Rivest

for MIT Laboratory for Computer Science, and trademark of RSA Data Security.

• It is a fast, symmetric block cipher [1].

• Uses data-dependent rotations and works on a variable word size, number of rounds and has variable length secret key[1]

• It is iterative in nature and user can choose tradeoff between higher security and speed[2]

• Adaptable to processors of different word lengths.

• Has a low memory requirement

Page 3: I mage encryption using rc5

Basics Of RC5The Main Parameters are:

• w: This is the word size, in bits

• r: This is the number of rounds the encryption algo will have

• b: The number of bytes in the secret key, K

The RC5 parameters can be chosen by the user such that the security and the speed of the algo are optimized for the users application (unlike the DES)

RC5 uses data dependent rotations:• “one word of intermediate result is cyclically rotated

by an amount determined by the result of another byte “ [1][2]

Page 4: I mage encryption using rc5

RC5 Primitive OperationsThe application of the algorithm involves certain mathematical operations, which are:

• addition of words denoted by “+”

• Bit wise exclusive OR of words “ ”⊕

• A left or right rotation of bits denoted by “ ” and “ ” resp.⋘ ⋙• Lg(x) to denote the base-2 logarithm of x.

These operations are directly supported by most processors

The operations require finite time, i.e, the computation time is independent of the size of the variables.[1][2]

Thus the computational complexity of the algorithm is very low

Page 5: I mage encryption using rc5

AlgorithmRC5 algorithm consists of 3 main components[3]:

Key Expansion Encryption

Decryption

RC5 Algorithm

Page 6: I mage encryption using rc5

1] Key Expansion• The user key K is expanded to fill the expanded key array S.

• The array has length t=2r+2

• Use 2 magic numbers: and

= Odd((e-2) )

= Odd((φ-1) ) Φ= 1.16180339

K[0,1,2….b-1]

Key

Converting bytes to words

For i=b-1 to 0 doL[i/u] = (L[i/u] 8) + ⋘K[i];

u=w/8, c= b/u L[0,1,2….c-

1]

Page 7: I mage encryption using rc5

Initializing array S

S[0] = ;For i=1 to t-1 do S[i] = S[i-1] +

u=w/8, c= b/u S[0,1,2….t-

1]

L[0,1,2….b-1] Mixing array S

and L

i=j=0;A=B=0;do 3*max(t,c) timesA= S[i]=(S[i] +A +B) 3⋘B=L[j]=(L[j] +A+B)

(A+B);⋘i=(i+1)mod(t);J=(j+1)mod(c);

u=w/8, c= b/u

S[0,1,2….t-1]

S[0,1,2….t-1]

+¿

Page 8: I mage encryption using rc5

2]Encryption• For encryption we assume that we are given two w-bit registers A

and B2w

A B

Intermediate values of S[0…t-1}

*Pseudo code:

A=A+S[0]; B=B+S[1]; for i=1 to r do A = ((A ⊕B ) B) +S[2*i]; B= ((B ⊕A ) B) +S[2*i+1];

Img 1

Page 9: I mage encryption using rc5

Features:• Heavy use of data dependent rotations[3]

• The encryption/decryption routines are very simple

• A round ends by adding expanded key from S to the intermediate values just computed. This assures each round acts in a potentially different manner[2][3]

• The XOR operations provide avalanche properties, causing single bit change in an input block to cause multiple bit changes in following rounds[2][3]

Page 10: I mage encryption using rc5

Standard Image

Encryption Algorithm

At TX

Transmitted Image

Image Encryption

Page 11: I mage encryption using rc5

Image Encryption• Altering Structure of a visual image so that it cannot be inferred

by an observer (human or a machine)

• Achieved by employing randomness to a visual image so that it is of no use to unauthorized people[4]

• Need For Image Encryption[3][4]:

• Secure the contents of digital images

• Real time secure image transmission over Internet

• Traditional Cryptosystems cant be used on images directly

Page 12: I mage encryption using rc5

Standard Methods• Image Encryption algorithms can be classified as[6]:

• Position permutation based algorithm[7]

• Value transformation based algorithm[8]

• Visual transformation based algorithm[9]

• Blowfish Algorithm: A modified version of the DES

• Image encryption based on chaos and improved DES

• Using Affine transformations

Page 13: I mage encryption using rc5

Standard Methods

Position Permutation

Value Transformation

Visual Transformation

Page 14: I mage encryption using rc5

Problem with conventional Methods

Not suitable for practical image encryption , such as on-line communication due to image features such as:

• Bulk data capacity

• High correlation among pixels

• Non flexibility in performance characteristics and level of security

• They may be susceptible to linear and differential cryptanalysis

Page 15: I mage encryption using rc5

RC5 - To the rescue

• Since RC5 is a parameterized algorithm it provides great flexibility in both performance characteristics and level of security

• RC5 requires only 3 basic computations : addition, XOR and rotation

• Due to the data dependent rotations , it is useful in preventing differential and linear cryptanalysis[3]

Page 16: I mage encryption using rc5

Encryption of Digital Images using RC5• Take a plain image as input and get a cipher image as output

which can then be transmitted

• The image stream is divided into 2w-bit blocks

Plain Image

2w

RC5Algorithm

Expanded Key

Cipher Image

• The first 2w bit block of image is taken as plain image to the encryption block

• In the next iteration the next block is taken and so on until end of image

• For this the key must have been expanded beforehand

Page 17: I mage encryption using rc5

Complete Process

r-rounds

KeySchedule

Initial Key Addition

Mixing Circular shift-Key addition

2-r round keys

2-round keys

Key b-byte

Plain image 2w-bit

Circular Shift

Cipher Image

Page 18: I mage encryption using rc5

Efficiency Evaluation of Image Encryption• Image encryption methods can be evaluated on the basis of :

• Visual Inspection : The 2 images should not be visually similar

• Total deviation in pixel values between original images and encrypted image: This value should be large to avoid crypt

analysis

• Information entropy: A value of ≈8 means a random source

• Correlation Value: The plain image and cipher should not at all be related to each other. This value should ideally be 0

• Avalanche effect : A change in single pixel value should

• Histogram uniformity: The histogram distributions of original and encrypted image should be different and distribution should be

uniform

Page 19: I mage encryption using rc5

Images encrypted using RC5

Page 20: I mage encryption using rc5

Evaluation of RC5 for Image Encryption[3]

• There is no visual information observed in the encrypted image and the encrypted images are indistinguishable even if they are from different sources.

• Deviation values are maximum in CBC,OFB and CFB modes and least in ECB.

Page 21: I mage encryption using rc5

• Correlation values are least in CBC,OFB and CFB and highest in ECB . The values are of the order .

• For avalanche effect, RC5 is highly sensitive to small changes in the plain image. The result of change in 1 pixel has great influence and results in good diffusion.

• The calculated mathematical value of information entropy is very close to the theoretical value of 8.

Page 22: I mage encryption using rc5

• Histograms for both plain and cipher are fairly uniform and different

Plain Image

Cipher Image

Page 23: I mage encryption using rc5

Conclusion

• RC5 offers an efficient way for practical implementation of image encryption

• Its efficiency analysis reveals that it is least efficient in EBC mode

• It has an efficient algorithm structure ,is immune to attacks and has an efficient diffusion mechanism

• Due to its parametric structure, it is modular.

Page 24: I mage encryption using rc5

References:[1] Rivest,R.L (1997), “The RC5 Encryption Algorithm”. MIT Laboratory for computer Science

[2]Rivest,R.L (1995),”RC5 encryption Algorithm ”, Dr. Dobbs Journal,226,146-148

[3]Faragallah, O.S. ” Digital Image Encryption Based on the RC5 Block cipher Algorithm” , Springer Science + Business Media,2011

[4]Dhanya B.Nair, Ruksana Maideen, “Chaotic Image Encryption using RC5”, International Journal of Image processing and Vision Sciences, Vol1,4, 2012

[5]Komal D Patel, Sonal Belani, “Image Encryption Using Differnet Techniques: A Review”, International Journal of Emerging Technology and Advanced Engineering, Vol. 1, Iss 1, 2011

[6]Indrakanti, S.P, P.S Avadhani ,”Permutation based Image encryption Technique”, International Journal Of Computer Applications,Vol 28-No.8 2011

[7]M.A Younes, Aman Jantan, “Image Encryption Using Block Based Transformation Algorithm”, IAENG International Journal Of Computer Science, 35:1

[8]Young C. Hou, “Visual Cryptography for color Images”, Elsevier-The Journal of Pattern recognition society.

[9] Ozturk, I. Sogukpinar I. ,”Analysis and Comparison of Image encryption Algorithms”World Academy Of Science Engineering And Technology, 2007

[10] RC5 Intermediate block diagram from Wikipedia

Page 25: I mage encryption using rc5

Thank You