Anda di halaman 1dari 5

IPASJ International Journal of Information Technology (IIJIT)

Web Site:

A Publisher for Research Motivation ........
Volume 7, Issue 3, March 2019 ISSN 2321-5976

Using Genetic Algorithm to Encrypt Image

Dr. Alsadig Mohammed Abdallah1, Dr. Mandour Mohamed Ibrahim 2
Information Technology Department, College of Computer and Information Sciences,
AL-Imam Muhammad ibn Saud Islamic University, Kingdom of Saudi Arabia

In the Digital world, information security becomes a main concern. Encryption algorithms have emerged as
practical tools for ownership authentication and copyright protection. Digital images play a vital role in our daily
lives as a big source of information and a lots of algorithms have been proposed for digital image encryption.
Among them, Genetic algorithm (GA) has been used often in conjunction with well-established cryptography
strategies or in a stand-alone fashion. There are many different image encryption methods, in this paper we will
introduce the method that is called Genetic Algorithms (GA) are used to produce a new encryption method
(Crossover and Mutation). Excellent results show that the proposed method can be used effectively for image
Keywords: genetic algorithm; Crossover; Mutation; Symmetric Key.

Encryption is a common technique to uphold image security. Image and video encryption have applications in various
fields including internet communication, multimedia systems, medical imaging, Tele-medicine and military
communication .Zeghid, Machhout et al. (2007)
The encryption function is the mechanism used to provide a confidentiality service. This function enables the
modification of a string of bytes in order to make it incomprehensible to anyone who is not authorized to know its
content. Encryption is done using two types of algorithm: symmetrical or secret‐key algorithms and asymmetrical or
public key algorithms. Perez (2014)
Also we use the term "Cryptography”, The word cryptography is derived from the Greek words kryptos, meaning
“hidden,” and grafein, meaning “to write.” Throughout history, cryptography has been used to hide messages inside
traditional means of communication that might otherwise be intercepted. Doing so is accomplished by concealing the
contents of the message from all except who has the key to unlock it. In modern times, cryptographic techniques are
used to protect e-mail messages, information transmitted over the internet, credit card information, and data on
corporate networks. Edge and O’Donnell (2016).


Cryptographic systems for information security depend on the existence of huge solution spaces to discourage attack.
indeed, in the design of any cryptographic system it is an important point that the basic algorithm deters attempts to
break it using so-called brute force attacks, involving simply running though all possible ways in which the algorithm
could have encrypted the target data. Al-Husainy (2006)
The main difficulty today in developing secure systems based on public key cryptography is not the problem of
choosing appropriately secure algorithms or implementing those algorithms. Rather, it is the deployment and
management of infrastructures to support the authenticity of cryptographic keys: there is a need to provide an assurance
to the user about the relationship between a public key and the identity (or authority) of the holder of the corresponding
private key. In a traditional Public Key Infrastructure (PKI), this assurance is delivered in the form of certificate,
essentially a signature by a Certification Authority (CA) on a public key. Of note are the issues associated with
certificate management, including revocation, storage and distribution and the computational cost of certificate
verification. These are particularly acute in processor or bandwidth-limited environments. Al-Riyami and Paterson
Identity-based public key cryptography (ID-PKC), first proposed by Shamir, tackles the problem of authenticity of keys
in a different way to traditional PKI. In ID-PKC, an entity’s public key is derived directly from certain aspects of its
identity. Private keys are generated for entities by a trusted third party called a private key generator (PKG).

Volume 7, Issue 3, March 2019 Page 21

IPASJ International Journal of Information Technology (IIJIT)
Web Site:
A Publisher for Research Motivation ........
Volume 7, Issue 3, March 2019 ISSN 2321-5976

2.1 Pseudo-random number generators

A pseudo-random number generator produces a substantially Gaussian distribution of output numbers from a
succession of uniform random numbers. In each cycle uniform random numbers are produced and applied to an adder
operative to form cumulative sums. A counter is responsive to carry signals from the adder and the outputs of the adder
and counter are combined to form an output pseudo-random number. The number of permitted adding operations is
preset. Reddaway (1974).

2.2 Symmetric Key Cryptography

Symmetric key cryptography is also called secret-key or shared key cryptography. In this type of mechanism, the sender
and receiver shares a common key for both encryption and decryption. The method follows self-certification method i.e.
the key is self-certified. The key needs to be shared through secret communication. If it is compromised, then the
encrypted message can be easily decrypted by the attacker. This type of cryptographic technique is required because it
provides faster service without using many resources. Various algorithms have been developed so far to describe
symmetric key cryptography. These are AES, DES, 3DES, Blowfis. Chandra, Paira et al. (2014).

Figure 1 Symmetric Key Cryptography

2.2 Asymmetric Key Cryptography

This technique is popularly known as Public Key Cryptography. This cryptography uses a pair of keys, public key and
private key. Public key encrypts the data whereas corresponding private key is needed to decrypt the data. The public
key is known to all and the data is encrypted using the public key, if someone wants to read it then the corresponding
private key is needed. These are RSA, Diffie-Hellman, ECC and Digital Signature Algorithm. Kumar (2013).

Figure 2 Asymmetric Key Cryptography

GA, proposed first by John Holland at 1975, is one of the most famous evolutionary algorithms which is inspired from
human evolution process. Genetic algorithm (GA) has been used frequently to solve different optimization
Genetic algorithm is population based algorithm which starts with an initial population of individual usually randomly
generated. These individuals are selected for reproduction based on probability proportional to its fitness. In other
words, the fitter the chromosome, the more times it is likely to be selected to reproduce. Then, mutation and crossover
operations are applied to the individuals to produce offspring .Afarin and Mozaffari (2013).
The rates of mutation and crossover rely on the application. Crossover operator randomly chooses a locus, specific
position in the chromosome, and exchanges the subsequences before and after that locus between two chromosomes to
create two offspring. Mutation operator randomly alters some of the bits in a chromosome. To overcome local minima
problem, mutation is usually used with a very low probability.
Genetic algorithm is a randomized search and optimization technique guided by the principle of natural selection
systems. Three basic operators used in Genetic algorithms contain: selection, crossover and mutation. The GA goes

Volume 7, Issue 3, March 2019 Page 22

IPASJ International Journal of Information Technology (IIJIT)
Web Site:
A Publisher for Research Motivation ........
Volume 7, Issue 3, March 2019 ISSN 2321-5976

through the following cycle: Evaluate, select, mate, and mutate until some stopping criteria are reached. Reproduction
and crossover together give genetic algorithms most of their searching power. Soni and Agrawal (2012).
3.1 Selection
It is quantitative criterion based on fitness value to choose the chromosomes from population which are going to
3.2 Crossover
In crossover operation two chromosomes are taken and a new is generated by taking some attributes of first
chromosome and the rest from second chromosome. For example, the strings 11001011 to 01101010 could be crossed
over after the third locus in each to produce the two offspring 11001010 to 01101011.
There are three type of crossover operation Single Point Crossover, Two Point Crossover, Uniform Crossover. Figure 3
showed the working of crossover operator. Figure (a) illustrates the bits contained in two strings. Figure (b) both the
strings are detached from their third locus.

(c) new population after crossover operation.

1 1 0 0 1 0 1 1

0 1 1 0 1 0 1 0
Figure 3 - (a) Working of Crossover Operator

1 1 0 0 1 0 1 1

0 1 1 0 1 0 1 0

Figure 3 - (b) Working of Crossover Operator

1 1 0 0 1 0 1 1

0 1 1 0 1 0 1 0
Figure 3 - (c) new population after crossover operation.
3.3 Mutation
Mutation is used to maintain genetic diversity from one generation of population to the next. It is similar to biological
mutation. GAs involves string-based modifications to the elements of a candidate solution. These include bit-reversal in
bit-string GAs. This operator randomly flips some of the bits in a chromosome. For example, the string 00000100
might be mutated in its second position to yield 01000100. The basic GA Cycle has been showed in fig4.

Figure 4. Basic Model of Genetic Algorithm

Volume 7, Issue 3, March 2019 Page 23

IPASJ International Journal of Information Technology (IIJIT)
Web Site:
A Publisher for Research Motivation ........
Volume 7, Issue 3, March 2019 ISSN 2321-5976

4. Proposed method
Step(1): Consider an image I(WxH) ,such that W and H are the width and height of I. Split the image I to a set of N
vectors of Length L(L=64 bytes in this work).

Step(2): then find R1 and R2 from the equations:

Assume the value (R1+R2)/2 as the start value of any known random numbers generation algorithm used that in this
encryption method.

Step(3):Set x=R1 and y=R2.

For I=0…..N-1,set the following information for each vector Vi from the set of N vectors:
 CrossoverIndex=x
 CrossoverIteration=Vi(x)
 MutationIndex=y
 MutationIteration=Vi(y)
 X=x+1
 Y=y+1
If (x or y)>=L then set x=0 and y=0

Step(4):For i=0…N-1,perform Step(5) and Step(6) for each vector Vi from the set of N vectors. Note that both values in
Vi (CrossoverIndex) and Vi (MutationIndex) are not participate in the crossover and mutation operation.
Step(5):(crossover operation):
 Set Crossover Index of vector Vi as new start value of the adopted random number generation algorithm.
 For J from 0 to Crossover Iteration of vector Vi, generate two random numbers N1 and N2 with values between
(0..L-1), then perform Vi(N1) Vi(N2)

Step (6) :(mutation operation)
 Set MutationIndex of vector Vi as a new start value of the adopted random number generation algorithm.
 For j from 0 to Mutation Iteration of vector Vi, generate one random number N1 with values between (0..L-1),
then perform Vi(N1)=255-Vi(N1).
Step (7): Construct an encrypted image from the set of N encrypted vectors that are produced from the Step (4). Then
hide the values R1 and R2 in the encrypted image.

Certainly, the proposed decryption method is done in the reverse from of the above encryption method.

5. Conclusion
This paper proposes suggested method for data security (Genetic Algorithm), by using Genetic algorithm we will
increase the efficiency of the algorithm in terms of computation time required and complexity to attack the message. It
uses the concept of crossover and mutation to extend the complexness of key by increasing the irregularity of the key.
And also the encryption method will fulfill the requirements that should be in any image encryption technique.

[1] Afarin, R. and S. Mozaffari (2013). Image encryption using genetic algorithm. Machine Vision and Image
Processing (MVIP), 2013 8th Iranian Conference on, IEEE.
[2] Al-Husainy, M. A. (2006). "Image encryption using genetic algorithm." Information Technology Journal 5(3):

Volume 7, Issue 3, March 2019 Page 24

IPASJ International Journal of Information Technology (IIJIT)
Web Site:
A Publisher for Research Motivation ........
Volume 7, Issue 3, March 2019 ISSN 2321-5976

[3] Al-Riyami, S. S. and K. G. Paterson (2003). Certificateless public key cryptography. International Conference on
the Theory and Application of Cryptology and Information Security, Springer.
[4] Chandra, S., et al. (2014). A comparative survey of symmetric and asymmetric key cryptography. Electronics,
Communication and Computational Engineering (ICECCE), 2014 International Conference on, IEEE.
[5] Edge, C. and D. O’Donnell (2016). Introduction to Cryptography. Enterprise Mac Security, Springer: 497-499.
[6] Kumar, A. (2013). "Asymmetric Key Cryptography."
[7] Perez, A. (2014). "Introduction to Cryptography." Network Security: 1-26.
[8] Reddaway, S. (1974). Pseudo-random number generators, Google Patents.
[9] Soni, A. and S. Agrawal (2012). "Using genetic algorithm for symmetric key generation in image encryption."
International Journal of Advanced Research in Computer Engineering & Technology (IJARCET) 1(10): pp: 137-
[10] Zeghid, M., et al. (2007). "A modified AES based algorithm for image encryption." International Journal of
Computer Science and Engineering 1(1): 70-75.


Dr. Alsadig Abdallah received the B.S. and M.S and PHD degrees in Information Technology from AL NEELAIN UNIVERSITY.
He was a Head of Information Technology Department on ALGADRIF UNIVERSITY in Sudan, and now working as Assistant
Professor on Al-Imam Mohammad ibn Saud Islamic University in Saudi Arabia. He has scientific papers related with Encryption
and Cloud Computing.

Dr. Mandour M. Ibrahim is working as Assistant Professor at Al-Imam Mohammad ibn Saud Islamic University college of
computer science and information system,

Volume 7, Issue 3, March 2019 Page 25