You are on page 1of 5

A NEW ENCRYPTION AND DECRYPTION ALGORITHM

COMBINING THE FEATRURES OF GENETIC ALGORITHM(GA)


AND CRYPTOGRAPHY.
Nalini . N, Lecturer, Dept. Of. CSE, SIT, Tumkur-3
Dr.G.Raghavendra Rao,Principal,NIE,Mysore

ABSTRACT
This paper demonstrates the possibility of exploiting the features of Genetic Algorithm in a deterministic way,
to generate PseudoRandom Numbers(PRNs) using Linear Congruential Method. Successfully using these PRNs
to evolve a new method for Encrypting and Decrypting the messages.

Key words: Genetic Algorithm, Encryption, Decryption, Linear Congruential Method.


1. INTRODUCTION
Basically GAs are a heuristic search, optimization and machine learning [1] technique based on the principles of
the Darwinian idea of Survival of the fittest and natural genetics.
Cryptography is the science of making communications unintelligible to everyone except the intended
receiver(s).A cryptosystem is a set of algorithms, indexed by some key(s), for encoding messages into cipher
text and decoding them back into plaintext [3]and [5].
The model for a secret key system, first proposed by Shannon [2] is shown in fig1.1

Fig1.1: Shannons model of secret communication


Enemy Cryptanalyst

Plaintext

Encryption
by Sender

Decryption
by Receiver

Plaintext

Secure Channel

Key(s) Source

This paper gives a new algorithm developed by us for encryption and decryption. The method combines the
concept of Genetic Algorithm and Cryptography in a very different way.
The idea is to use the GA in a deterministic way to generate Pseudo Random Numbers.The GA operators
CrossOver and Mutation are applied deterministically. The reason to use GA is to exploit the features of GA
deterministically and also GA is fast.
The encryption and decryption algorithms will be made Public. But the NINE parameters of the key give secure
strength to the algorithm making the intruders effort to break the cipher a failure one.
The algorithm proceeds with both the parties (sender and receiver ) knowing the values of the nine parameters
of the key
Namely,
KEY = {Xn, a, c, m, Final_Array_Size, Starting_Number, Ending_Number, Modulus, Remainder}
Where
1. Xn, a, c, and m are the parameters of the Linear Congruential Method whose values are known only to
the sender and the receiver.

2.
3.
4.
5.

Final_Array_Size is size of the array until which the random numbers are generated.
Starting_Number is the number to start with in the Final_Array_size numbers.
Ending_Number is the number to end with in the Final_Array_Size numbers.
Modulus is the number used to extract only those numbers to be used for substitution which give the
remainder Remainder when the numbers between staring_Number and Ending_Number are divided by
Modulus.

Any intruder although he has at his disposal the Encryption and Decryption algorithm and the cipher text, it will
be very difficult for him to guess all the nine parameters correctly. In this sense this algorithm is assured to be
very secure.

2. PRNG USING GA AND LINEAR CONGRUNTIAL METHOD


Assumptions about GA
1.
2.
3.
4.
5.

Final_Array_Size is 5000 (can be varied to higher values also).


Length of the chromosome is 13 (can be varied)
Representation of chromosome is Binary.
Population size is fixed to 100 (could be varied)
Hence 50 generations are required to generate 5000 numbers.

By far the most widely used technique for PRNG is an algorithm first proposed by Lehmer, which is known
as Linear Congruential method[4]. The algorithm is parameterized with four numbers as follows:
m
the modulus
m>0
a
the multiplier
0<= a < m
c
the increment
0<= c < m
the sequence of random numbers is obtained via the following Iterative equation
Xn+1 = (aXn +c)mod m.
Where Xn is the seed value also it is the value of the first chromosome of the first generation
Generation 1
X0=Xn
Xn+1=(aXn+c)mod m
Population Size =100
X99
Once the numbers of the first generation is created the next generation numbers are generated using the GA
operators CROSSOVER AND MUTATION
3. CROSSOVER

Here the number of crossovers to happen is taken to be popsize/2


If the generation is even numbered then the crossover happens from top to bottom in a sequential way
by pairing chromosomes like (1,2)(3,4)(5,6)..
If the generation is odd numbered then the crossover happens from bottom to top in a sequential way
by pairing chromosomes like for ex (100,99)(98,97)..
Some assumptions regarding the crossover site is also done in the algorithm which helps to avoid
repetitions of numbers generated.

4. MUTATION
Since the representation of the chromosome is binary, just invert bit values at particular gene locus. Here too
some assumptions are followed in the algorithm.

5. ENCRYPTION
According to our assumptions
once all the 5000 numbers are generated choose subset of numbers from this using starting_number
and ending_number values.
Out of this choose only those numbers which give remainder Remainder when divided by
Modulus.(This increases one more level of security).Let us call this array of numbers as
SUBSTITUTION_ARRAY
Use these numbers sequentially for substituting on a one-to-one basis for the characters of the
Plaintext.
Use ASCII values of the plaintext characters to divide the corresponding number choosen and strore
the Quotient and the remainder in an array.
Ciphertext = Array containing quotient and remainder.
6. DECRYPTION

Once cipher text is got a for loop is run from 1 to 256 and each ASCII value is multiplied and
remainder is added and compared with numbers in the SUBSTITUTION_ARRY.
The ASCII valued character which matches correctly with numbers in the SUBSTITUTION_ARRAY
is stored in a separate array and finally read as message.
Care is also taken if the numbers of the SUBSTITUTION_ARRAY happens to be zero.

7. RESULTS
For the message SECRET MISSION with Modulus =35 and Remainder = 2 the SUBSTITUTION_ARRAY
numbers will be
{2627, 3747, 4867, 1227, 4027, 2347, 1227, 1227, 2347, 1227, 1227, 667, 2067, 1227, 667, 4867, 667, 1787,
3747, 4587}
ENCRYPTION
Character
ASCII
Value
S
E
C
R
E
T
M
I
S
S
I
O
N

83
69
67
82
69
84
32
77
73
83
83
73
79
78

SUBSTITUION_ARRAY
Numbers
taken
sequentially
2627
3747
4867
1227
4027
2347
1227
1227
2347
1227
1227
667
2067
1227

DIVISION

QUOTIENT

REMAINDER

2627 / 83
3747 / 69
4867 / 67
1227 / 82
4027 / 69
2347 / 84
1227 / 32
1227 / 77
2347 / 73
1227 / 83
1227 / 83
667 / 73
2067 / 79
1227 / 78

31
54
72
14
58
27
38
15
32
14
14
9
26
15

54
21
43
79
25
79
11
72
11
65
65
10
13
57

The Enciphered Message is


Quotients followed by Remainders
i.e CIPHERTEXT =
{31,54,72,14,58,27,38,15,32,14,14,9,26,15,54,21,43,79,25,79,11,72,11,65,65,10,13,57}

DECRYPTION
QUOTIENT

REMAINDER

31
54
72
14
58
27
38
15
32
14
14
9
26
15

54
21
43
79
25
79
11
72
11
65
65
10
13
57

FOR LOOP
FROM I=1 TO 256 DO
I*Q+R
AND
COMPARE
AND
CHOOSE I
83
69
67
82
69
84
32
77
73
83
83
73
79
78

CHARACTER

S
E
C
R
E
T
M
I
S
S
I
O
N

Example 2
********************************************************************************
SIMPLE GENETIC ALGORITHM AND CRYPTOGRAPHY
********************************************************************************
Enter the message that has to be sent, hit shift+6 to end message
SECRET MISSION^
Enter the Modulus Number and the Remainder (Remainder < Modulus number):
Remainder number (0-5000) :
896 3
The numbers that are selected
4483->3->4483->1795->3->899->4483->4483->4483->4483->1795->2691->3587->899->2691
->0->0->0->0->0->
the enciphered message is
54->0->66->21->0->10->140->58->61->54->21->36->45->11->1->72->61->73->72->59->3>17->30->1->52->63->32->41->
The Deciphered Message is:
SECRET MISSION
8. CONCLUSION
This algorithm successfully encrypts and decrypts all the 256 ASCII characters. The only drawback of this
algorithm is it needs twice the amount of storage space for a message i.e (quotient+remainder).This paper opens
a new avenue of research in the fields of GA and cryptography.

REFERENCES
[1] David E Goldberg, Genetic algorithms in search, optimization and machine
learning,Addision- Wesley Pub.Co.1989.
[2] C.E.Shannon, Communication Theory of Security System,Bell,System Technical
Journal, 28, 1949
[3] A.J.Bagnall, The Applications of Genetic Algorithms in Cryptanalysis, School of
Information Systems, University Of East Anglia, 1996.
[4] William Stallings., Cryptography and Network Security:Principles and Practice,
2/e, Prentice Hall, 1999.
[5] N.Koblitz , A Course in Number Theory and Cryptography, Springer-Verlag, New
York, Inc., 1994.

You might also like