-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProject Implementation
109 lines (96 loc) · 4.76 KB
/
Project Implementation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#TOOLS USED: PYTHON
#MODULES:
Pre processing
Encryption
Re shaping
Cross over
Mutation
#ABSTRACT:
In this technique,we take binaries of any type of digital data and convert it to DNA sequencing, reshape, encrypt, crossover, mutate and then reshape. The main stages of D-GET are repeated three times or more. Transmit the encrypted data in text/image format file. In other side, the receiver uses the D-GET to decrypt the received data and reshape it to original format. This Technique multiple key sequences to increase the degree of diffusion and confusion, which makes resulting cipher data difficult to decipher and makes to realize a perfect secrecy system. Experimental results demonstrate that proposed technique has multilayer protection stages against different attacks and higher level of security based on the multi-stages and genetic operations. Decrypted data are acceptable because of there is absolutely difference between it and secret data.
STAGES:
Pre-processing Stage
After reading secret data, this data must be preparing depending into its type. In case text file, it is converted into ASCII values. Group them into 8-bits Binary data. Every two adjacent bits are transferred to the four bases; adenine (A), cytosine (C), guanine (G) and thymine (T), found in DNA
Encryption stage:
After conversion binary data to DNA sequencing then encrypt using key. The key may be DNA sequence or binary string. The key has variable length. If one or both of data and DNA sequence key DNA sequence, it will convert to binary form then, perform an exclusive OR operation on the corresponding elements of them and convert back to DNA sequence.
Reshaping Stage
After Encryption, A basic genetic algorithm is
composed of three operators; reproduction, crossover and mutation. To produce genetic material that pass to the next operation and iteration in the form of chromosome population, the Reshaping stage is used. In this stage, first number and length of chromosome are determined. These values may be constant are varied for every round. Reshape it by align the DNA sequence into rows to construct parents’ chromosomes (chromosome population) with pre-defined length.
Crossover Stage
After constructing parents’ chromosomes, the next operation is crossover. There are two types of crossover. These may be sequentially used in technique rounds. In the first one, the parents are selected in the mating pool. A single-point crossover point is selected between the first and last bits of the parents’ chromosomes then, creating two new offspring by exchanging the heads of parent1 and parent2. Consequently the offspring containportions of the DNA codes of both parents
Mutation Stage
After crossover process, the chromosomes are
subjected to mutation. Mutation is the alteration of string elements. Two types of mutation are used. In the first one, convert data to binary vector and define two mutation points between the first and last bits then complement bits in between i.e. single point mutation changes a 1 to a 0, and vice versa. In the second mutation type, convert each four bits to two bases of DNA (1010 -> CG). After conversion, reshape it to DNA bases vector and define two points between the first and last bases then alter DNA bases to another one (i.e., C -> G).
INPUT: A DNA sequence
OUTPUT: Encryption and decryption of data using DNA-Genetic Encryption Technique
A SIMPLE EXPLAINATION OF PROJECT:
Setglobal:
Used to set no of rounds
No. Is Determined randomly
No of rounds: no of times genetic algo is applied
Encryptkey:
Get data
Key ( dna form or binary form)
Convert both to same form and do xor only if key size<data size
Reshape:
Split the dna sequence into n no of rows with same column size
How?
Find length of dna sequence and find divisor of tat no. and take 1 random no from tat divisor
This is row
Column: dna sequence length/row value
Reverse reshape:
From n row for fixed column size to normal size
Eg: ab
Ch
Gives
Abch
Eg:
Abcg
Gives
Ab
Cg
Rotate crossover:
Get Random no p between 0 and 1
If > 0.5 shift right by generation of another random no
Eg:
P = 0.8
1111 0000
Random no = 4
Then shift right by 4
0000 1111
If p<0.5 shift left
Single pt cross over
Get a random no
And shift up with down
Eg:
Random no is 5
1111 0 1111
0000 1 0000
0,1 is at position 5
So,
1111 1 1111
0000. 0 0000
Crossover :
Find 3 random no and based on it decide single pt or rotate or both
Complement
Find random no
At tat point convert 0 to 1
1 to 0
Alter dna
Find 2 random dna item and swap them
Eg: abcd
Pt:2,3 so b becomes c and c becomes b
So
Acbd
Mutation :
Calls complement and alter dna
+
Convert every 4 bit into a DNA
Eg : 1111 is g
1011 is a
Like ta
Get dna :
Calls all d above mentioned modules one by one
Main:
Get text
Write in a file
Convert Text to dna seq and do encryption as mentioned above.