Home » Articles » Research: Using the genetic algorithm to generate symmetric keys for cryptography
Click Here To Hide Tor

Research: Using the genetic algorithm to generate symmetric keys for cryptography

Cryptography has evolved to become an indispensable tool to protect data shared online. There are currently multiple types of cryptographic approaches used to secure data. Automatic Variable Key (AVK) is one of the most recent cryptographic approaches proposed by researchers. In AVK encryption algorithms, the initial key is distributed via Rivest-Shamir-Adleman (RSA). The genetic algorithm has been recently proposed for usage to develop advanced encryption algorithms. The genetic algorithm can be utilized in the development of stream ciphers. Key generation represents an essential step in the process of development of stream ciphers.

A recently published research paper proposes a new cryptographic technique that uses artificial intelligence (AI) to distribute the initial key to both parties via a fitness function based on the genetic algorithm. This novel technique is introduced to overcome the problems associated with RSA’s initial key distribution. Developers of the technique used the statistical tools of the National Institute of Standards Technology (NIST) to test the new cryptographic technique, confirm the randomness of the auto-generated keys, and compare the technique with current cryptographic techniques. Three different experiments are used to calculate the Standard Deviation of Hamming distance and the obtained values were 8.05, 6.44, and 7.05, which denote high levels of performance as compared to currently available techniques.


Let’s take a look at how the genetic key can be used to generate an encryption key.

Generating an encryption key using the genetic algorithm:

First, a binary population should be generated. Each cell is created via the pseudo random number generator of the used programming language. The generated number is one, provided that the PRNG yields a number greater than 50, otherwise it is zero. Each chromosome includes 25 cells and the number of chromosomes is set to 1000.

Now, for every chromosome, the following process is repeated:

1- The chromosome is divided into 5 groups.

2- In each group, calculate the number of ones.

3- If the number of ones is > 2, the new array will have a cell with a value of 1, otherwise it will have a value of zero.

4- The former step transforms the population of chromosomes with 25 cells to one with 5 cells. Thus, we will have a 5 x 1000 array.

5- Then, the array is read vertically with 25 cells in each round. The first column is read, followed by the second column, and so on.

6- The former step will yield an array of 25 x 200 which will then serve as the population. This will be followed by application of crossover and mutation operators to the sample.

7- Now, each cell will be multiplied by 2 (12-i), where i represents the cell number. This will generate a sample of 200 numbers.

8- Each number will then be converted into an integer. This step will be repeated five times. The coefficient of auto correlation will then be calculated. If the result of this step is favorable, then the population will be accepted, otherwise the whole process will be repeated.

Let’s apply these steps to an example:

Let’s assume the original population is a 5 x 5 population where the cells are randomly generated






The above population is then read vertically. This will produce the following new array:






Any two random numbers are then generated from zero to five, let’s say, the 2nd and 4th chromosome.

One point crossover is then performed as shown below:



Taking a crossover point (COP) = 2. The chromosome will become:


After crossover is completed, the mutation is performed via selection of a random chromosome and flipping from among those chromosomes:


The number of times a crossover is to be completed is calculated by the formula:

Number of crossovers = Number of cells within each chromosome x number of chromosomes x crossover rate / 100

The number of times a mutation is to be completed is calculated by the formula:

Number of mutations = Number of cells within each chromosome x number of chromosome x number of chromosomes x mutation rate / 100

Once the task is completed, the Coefficient of Correlation of the above is calculated via taking k=1, 2, and 3.

The coefficient of autocorrelation is defined by the following formula. With measurements Y1, Y2,….., YN at time X1, X2,….XN , the lag k autocorrelation function is calculated by the following formula:


If the Coefficient of Correlation produced is satisfactory, then the random chromosome is chosen which is then taken as the key for the encryption algorithm, otherwise the process is repeated.

Leave a Reply

Your email address will not be published. Required fields are marked *


Captcha: *