Next Article in Journal
Optimization of Wheelchair-Mounted Robotic Arms’ Base Placement by Fusing Occupied Grid Map and Inverse Reachability Map
Next Article in Special Issue
UAV Detection and Tracking in Urban Environments Using Passive Sensors: A Survey
Previous Article in Journal
Double-Tongue Worm Shell Structure on Plastic Centrifugal Pump Performance Study
Previous Article in Special Issue
A Combined Multi-Classification Network Intrusion Detection System Based on Feature Selection and Neural Network Improvement
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Hash Based DNA Computing Algorithm for Image Encryption

1
Electronic Information Engineering, Ningbo Polytechnic, Ningbo 315000, China
2
Key Laboratory of Water Big Data Technology of Ministry of Water Resources, Hohai University, Nanjing 211100, China
3
College of Computer and Information, Hohai Univerisity, Nanjing 211100, China
4
Key Laboratory of Symbolic Computation and Knowledge Engineering of Ministry of Education, Jilin University, Changchun 130012, China
5
Nanjing Hezehaichuan Technology Company, Nanjing 211100, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2023, 13(14), 8509; https://doi.org/10.3390/app13148509
Submission received: 3 March 2023 / Revised: 21 June 2023 / Accepted: 20 July 2023 / Published: 23 July 2023
(This article belongs to the Special Issue Deep Learning and Edge Computing for Internet of Things)

Abstract

:
Deoxyribonucleic Acid (DNA) computing has demonstrated great potential in data encryption due to its capability of parallel computation, minimal storage requirement, and unbreakable cryptography. Focusing on high-dimensional image data for encryption with DNA computing, we propose a novel hash encoding-based DNA computing algorithm, which consists of a DNA hash encoding module and content-aware encrypting module. Inspired by the significant properties of the hash function, we build a quantity of hash mappings from image pixels to DNA computing bases, properly integrating the advantages of the hash function and DNA computing to boost performance. Considering the correlation relationship of pixels and patches for modeling, a content-aware encrypting module is proposed to reorganize the image data structure, resisting the crack with non-linear and high dimensional complexity originating from the correlation relationship. The experimental results suggest that the proposed method performs better than most comparative methods in key space, histogram analysis, pixel correlation, information entropy, and sensitivity measurements.

1. Introduction

With the breakthrough development of information technology, how to process data with secured and rapid characteristics has become a major concern [1]. Inspired by DNA structure, a novel computing paradigm using a biological molecule to carry genetic information is designed to ensure the feasibility of computing at a molecular level with impressive characterizations of programmability and high-throughput coding, which not only males it possible to replace traditional silicon-based facilities by biological tools [2], but also provides an alternative way to consider computing with more than 0 and 1. Therefore, DNA computing [3], as a popular computing model with considerable potential to meet the security requirement, has nowadays become a hot spot in the data processing domain.
In hardware-based data processing design, DNA logic gates are designed in combination with digital circuits, acting as basic components to form complex DNA circuits. For example, Zhang et al. [4] propose an entropy-driven incision-assisted recovery strategy for reactants in the DNA loop, which can recover reactants in the catalytic loop and improve their recoverability, creating more effective DNA circuits for molecular transformation and synthetic biology. Unlike most artificially catalyzed DNA loops, Yang et al. [5] develop a catalytic DNA logic circuit regulated by DNase, which is controlled by a covalent modification strategy and demonstrates a great potential in more complex computing by building complex cascade circuits.
In algorithm-based data computing design, molecular programming is built on the basis of DNA circuits with powerful modularity. For example, Zhang et al. [6] design a DNA molecular computing platform to analyze miRNA profiles in serum samples, achieving an intelligent diagnosis of cancer. Later, Ma et al. [7] design and implement various types of a DNA computing system, which verifies the feasibility of using DNA computing for intelligent diagnoses in fields of biology and biomedicine.
Despite various designs of clinical applications, DNA computing is popular for building a encryption application, due to its reliable encryption performance and parallel processing capability. Specifically, we could roughly divide encryption methods into two types, i.e., diffusion encryption and permutation encryption. Diffusion encryption refers to the process of spreading information throughout the ciphertext, thus increasing unbreakability of the encryption algorithm. More precisely, diffusion encryption maps each bit of the plaintext to multiple bits in the ciphertext. Any change in a plaintext bit should correspond to variations in multiple bits of the ciphertext, successfully achieving a correlation between the plaintext and ciphertext. Permutation encryption encrypts the plaintext by replacing each bit with a different bit, which reorders the information of the plaintext to hide content, instead of altering values of each bit in the plaintext. The key process of the permutation encryption is to establish a one-to-one mapping between each bit of the plaintext and ciphertext, thus achieving a confusion effect of information.
In fact, the quantity of algorithms have been proposed for data encrypting based on DNA computing. For example, Khan et al. [8] propose DNAact Ran, a DNA computing-based sequence analysis engine, which could accurately detect a ransomware attack with their designed constraints and kmer frequency vector. Combining DNA computing with chaotic systems, Zou et al. [9] involve the DNA-based strand displacement strategy with the chaotic system, where the generated chaotic sequence greatly improves the unbreakability of their encryption system, owing to its capability to stand with statistical attacks. Most recently, Namasudra et al. [10] propose a DNA computing-based access control algorithm, where 1024 random keys are fed into the DNA computing system for the user’s secret data encryption, significantly improving the security capability of the control model.
Inspired by the idea of utilizing DNA computing to encrypt, we aim to encrypt high-dimensional image data in this paper. Compared with text structure data, the image is characterized with high-dimensional and unstructured proptoses, which have two major difficulties in designing proper encryption algorithms. First, how to achieve an unbreakable capability for image data with less encoding complexity, since a more complex encoding strategy generally promotes encryption performance. Second, since the image is equipped with a natural property of high-dimensional complexity, how algorithms could involve such a property for for encoding. In other words, images are a natural source of randomness, where adjacent pixels marked with a considerable amount of redundant information demonstrate strong correlations. Therefore, the characteristic of smooth variation between pixels can be leveraged to speed up the image encryption process.
To address the above difficulties, we develop a novel hash encoding-based DNA computing algorithm to effectively encrypt high-dimensional image data, which consists of the DNA hash encoding module and content-aware encrypting module. The hash algorithm is unique in encrypting, which outputs a fixed-length output with data as complicated as possible. Moreover, it shares several impressive characteristics, such as a small computing burden with a simple function calculation; unidirectionality without possible ways to reverse the input data through hash results, tampering resistance where small modification would greatly vary the output results; and anti-collision capability, which guarantees that the unique output could be gained with different inputs. Inspired by these properties, we involve hash encoding into DNA computing inside the proposed DNA hash encoding module, thus boosting the encryption capability of high-dimensional data with a small computation burden. Considering high-dimensional image data as a natural source to encode with less complexity, a content-aware encrypting module is proposed to map between image content and encryption results with several simple but effective functions, thus offering new ways to encrypt images based on DNA computing.
To sum up, the contributions of this paper are three-fold:
  • The proposed method combines the impressive characteristics of DNA computing and the hash function to realize an unbreakable image encryption with less computation burden.
  • A novel DNA-based hash encoding module is proposed, which involves the hash function to construct mappings from high-dimensional image data to DNA bases.
  • Considering correlations between adjacent pixels as natural sources of complexity, the proposed content-aware encrypting module sunccesfully generates random DNA sequences with chaos properties, which adopts non-linear functions originating from correlations of pixles as source of complexity.
The rest of this paper is organized as follows. Section 2 reviews the related work. Section 3 first presents an overview on algorithm structure, and then presents detailed steps of encryption and decryption. Section 4 conducts several experiments, including an analysis on the key space, histogram, pixel correlation, information entropy, sensitivity and computation cost. Finally, Section 5 concludes the paper and demonstrates the prospect.

2. Related Work

In this section, we provide a brief literature review of this paper, including an introduction to DNA computing and DNA computing-based image encryption.

2.1. Introduction to DNA Computing

With the development of DNA computing, the DNA strand displacement reaction has gradually become an important means to build complex digital circuits operating at room temperature. To solve the limitations of DNA logic circuits, i.e., slow computing speed and complex circuit design, Song et al. [11] propose a DNA logic circuit structure based on single strand logic gates, which improves the computing speed of DNA circuits and the number of DNA strands based on the biological performance of the strand replacement DNA polymerase. Combined with the commonly used cascading strategy, their proposed structure could aid to build large-scale logic circuits.
To build the DNA-based switch circuit, Wang et al. [12] developed a modular DNA molecular switch for the digital operation of any function, which solves the limitation of operation speed and signal-to-noise ratio comparing with the traditional logic gate circuit. In their experiments, their proposed DNA-based switch circuit not only controls the current signal transmission through the switch signal, but also controls the current signal transmission direction through the difference of molecular free energy in the reaction path. Essentially, the development of the DNA switch circuit has laid a solid foundation for molecular computers with decision-making abilities. Therefore, Thubagere et al. [13] successfully developed DNA-based robots, which could autonomously transport molecular-level goods to a designated location without any energy supply.
To improve the security of the physical layer, DNA computing is designed for data encryption during transmission. For example, Liu et al. [14] propose an image encryption scheme, where the DNA-based image compression are used to ensure the security of transmission. Later, Xiao et al. [15] propose a chaotic OFDM (Orthogonal Frequency Division Multiplexing) hybrid security method to ensure the security of the physical layer, which not only dynamically adjusts parameters of DNA-based encoding rules and scrambling methods, but also controls the positional and traversal direction of the helix through chaotic sequences.

2.2. DNA Computing-Based Image Encryption

DNA computing builds the encryption system based on modular arithmetic cryptography. Moreover, a chaotic strategy has been proved to be well matched with DNA ciphers, due to its characteristics of pseudo randomness, unpredictability and so on [16]. For example, Babaei et al. [17] realize a theoretically unbreakable data encryption algorithm, where they build a chaos strategy based on the difference between the original and optimized DNA-based encryption messages. Later, Wang et al. [18] first use piecewise linear chaotic mapping (PWLCM) and logistic mapping to generate encryption parameters, and then use DNA computing for information encoding. Specifically, their PWLCM could make each small segment of the original data be paired with an element of the pseudo-random sequence, thereby increasing the complexity of the encryption algorithm. Afterwards, Samiullah et al. [19] use three chaotic systems including PWLCM, Lorenz and 4D Lorenz to build a multi-level security system, which could largely increase the non-repeatability of the key.
To reduce the computational cost of image encryption, Malik et al. [20] use a tent map to select key streams generated by their proposed confusing and diffusing channels. Later, Khan et al. [21] propose a DNA-based image encryption method to effectively reduce memory usage, which selects the most informativepart from the visual appearance analyzed by their proposed dependent chaotic system. Afterwards, Ravichandran et al. [22] propose a medical image encryption algorithm based on the combination of the integer wavelet transform (IWT), DNA and chaos system. Their strategy of utilizing the advantages of different encryption methods ensures the security of electronic health records during network transmission. Recently, Zhang et al. [23] proposed a multi-image encryption algorithm, which not only resists conventional attacks to protect image content, but also improves the transmission speed via Internet by reducing image size by encoding. Most recently, Wu et al. [24] designed a random encoding, sequencing and diffusion strategy based on content-aware DNA computing, which greatly improves the difficulty of cracking even if attackers obtain partial or all information of the transmitted image. Most relevant to our method, Chen et al. [25] propose an image encryption scheme that incorporates adaptive diffusion permutation and DNA random coding. We further improve their idea by involving the hash function and image content-based encoding, thus greatly improving the capability to resist different types of attacks.

3. Methods

We provide a detailed description of the proposed method with three parts, i.e., the overall framework, DNA hash encoding module and content-aware encryption module.

3.1. Overall Framework

We begin with an introduction to a basis of DNA computing in encryption. DNA bases are classified into four types, namely, adenine (A), thymine (T), cytosine (C) and guanine (G). It is worth noting that the former two types are complementary pairs, and so are the latter two types. We then describe rules for DNA-based sequence encoding, which uses a binary encoding idea to represent the input sequence under rules shown in Table 1 with four bases, i.e., A, C, G and T. With the aid of encoding rules of Table 1, we can convert binary sequence into a DNA-based encoding form for further computation. For example, under rule 2, A, C, G and T are represented as 00, 01, 10, and 11, respectively. If a pixel in the input image refers to 179 in gray levels and its binary representation is 10110011, its corresponding DNA-based encoding sequence should be G-T-A-T under rule 2. During decoding, if a DNA-based encoding sequence is G-A-T-C under rule 2, its corresponding binary value should be 10001101.
We then demonstrate the overall framework in Figure 1, which consists of sender and receiver structures. Specifically, the whole process of encryption inside the sender can be described as follows:
Step 1. Feed the initial key K and the input image I into the DNA hash encoding module, which computes the rule selection sequence Q r u l e and DNA-encoded Sequence  Q 1 .
Step 2. K and Q 1 are regarded as input of Content-aware Encryption module, which computes new sequence Q 2 with permutation and diffusion, thus encoding complexity for high unbreakability.
Step 3.  Q r u l e and Q 2 are fed into the DNA encoding module, which encodes Q 2 by utilizing Q r u l e to generate a binary bitstream under DNA encoding rules. Afterwards, we transfer the generated bitstream as a ciphered image C with H × W .
Step 4. Transmit C from the sender to the receiver via Internet.
The whole process of decryption inside the receiver can be described as follows:
Step 5. Regarding C as input, the receiver sends it to DNA hash decoding module with the initial key K, thus generating the rule selection sequence Q r u l e and a DNA-based decoding sequence Q 1 d . It is noted that we keep the rule selection sequence exactly the same to ensure the consistency of decryption content.
Step 6. Feed K and Q 1 d into the content-aware decryption module for the reversed permutation and diffusion, thus generating a reversed DNA-based decoding sequence Q 2 d .
Step 7. Feed Q 2 d and Q r u l e into the DNA decoding module, which uses Q r u l e as the rule selector to decode Q 2 d into the binary bitstream I b i t . Finally, we transfer I b i t into the output image I for computation. Note that the input and output image should remain the same due to the general principles of encryption.

3.2. Design of DNA Hash Encoding Module

The DNA hash encoding module is designed to transform image data into a DNA-encoded form with different DNA bases, which could involve significant properties of the hash function, i.e., fixed-length output, small computing burden, tampering resistance and anti-collision ability. Such property help improve the unbreakability of the proposed method with low computing cost.
As shown in Table 1, there only exist eight encoding patterns that satisfy the “complementary” rule, where each two bits satisfys the condition that there XOR results should be true. For example, if 00 and 01 are encoded as A and C, respectively, 11 and 10 should be encoded as T and G, respectively. There are only eight encoding rules obtained through this combination, and they are all listed in Table 1. Based on the analysis of the “complementary” rule, we convert image data into a bit stream with the size of 3 bits to describe 8 different mapping rules, where the 2 bit is mapped as one DNA base for the encoding basis. Meanwhile, two more 8-bit streams are designed at the beginning of the stream to record the length and width of the original image, which could help restore the input image after encryption in a proper way.
Essentially, the proposed DNA hash encoding module plays a crucial role in encryption, which randomly employs various sets of complementary rules to encode each pixel. We demonstrate the overall encoding process of it during encryption in Figure 2. The detailed steps of the encoding and decoding process inside the DNA hash encoding module are also listed with pseudo codes in Algorithms 1 and 2. First, we adopt the SHA256 algorithm to generate two important parameters, i.e., initial key value and initializing factor. To effectively improve the security of the cryptosystem, we then feed the computing factor p into the PWLCM, generating the rule selection sequence with the following equation:
x n + 1 = x n p , 0 x < p x n p 0.5 p , p < x 0.5 F ( 1 x n , p ) , 0.5 < x 1
It’s noted that p ( 0 , 0.5 ] , which enables variety in outcome with little modification in key values, whi ch is highly resistant to attack. Finally, we use the rule selection sequence to help encode the bitstream, which serves as DNA rules to encode pixels with DNA-based rules as shown in Table 1.
Algorithm 1: DNA hash encoding process
Input: Initial Key K, Plain Image I
Output: Rule Selection Sequence Q r u l e , DNA encoded Sequence Q 1
1   H , W = original height and original width of I;
2   Randomly generate H and W , where H < H < 2 × H and W < W < 2 × W ;
3   Convert the integer numbers H and W into a l6 bit binary bitstream H W b i t ;
4   Convert the plain image I into a binary bitstream I b i t ;
5   Randomly generate a binary bitarray R b i t whose length is H × W × 8 H × W × 24 16 ;
6   I b i t = H W b i t I b i t R b i t (where ⊕ indicates concatenate operation);
7   l e n g t h = Length ( I b i t ) ;
8   H A S H K = SHA256(K);
9   H 1 = H A S H K ( 0 : 63 ) ;
10   H 2 = H A S H K ( 64 : 127 ) ;
11   x 1 = m o d f H 1 / 10 15 ;
12   p = m o d f H 2 / 10 15 / 2 ;
13   For (t = 0 to  l e n g t h / 2 );
14     x t + 1 = P W L C M ( x t , p ) ;
15   X = [ x 1 , x 2 , . . . , x n ] ;
16   Q r u l e = m o d f l o o r X × 10 15 , 8 ;
17   Introduce the DNA encoding table T;
18   For (t = 0 to  l e n g t h / 2 );
19     Q 1 ( t ) = T ( Q r u l e ( t ) , I b i t ( 2 t , 2 t + 1 ) ) ;
20  Output Rule Selection Sequence Q r u l e , DNA encoded sequence Q 1 ;
Algorithm 2: DNA Decoding Process
Input: Rule Selection Sequence Q r u l e , DNA Encoded Sequence Q 2
Output: Cipher Image C
1   l e n g t h = Length ( Q 2 ) ;
2   T = DNA Encoding Table;
3   For (t = 0 to  l e n g t h );
4     C b i t ( 2 t , 2 t + 1 ) = T ( S r u l e ( t ) , S 2 ( t ) ) ;
5   Change cipher bit array C b i t into cipher image C;
6   Output Cipher Image C;
  For readers’ convenience, we further offer a step-by-step explanation of hash encoding in Figure 3, which performs an encryption process on a sample image, as follows:
Step 1. Obtain the height and width of the original image, where H and W equals 8 for the sample image. Convert the original image to a bitstream containing 512 bits of data.
Step 2. Save the original height and width as 16-bit data. For example, if H is 8, its corresponding bitstream is 00000000 00001000. Therefore, we use 32 bits of data to save the original height and width for further restoration.
Step 3. Randomly generate a new height and width, where both values should be larger but twice as small as the the original ones. For display, we set the new height H and width W to 12 and 10, respectively.
Step 4. It is noted that there exist H × W × 8 = 960 bits of data for encoding, where the first 32 bits represent the original height and width, and the other 512 bits refer to image content. It’s noted that 416 bits remain unused, where they are randomly filled to make up a total 960-bit bitstream for further computation.
Step 5. We generate a 256-bit bit sequence HashKey through the SHA256 hash algorithm based on the input initial key. Note that H 1 and H 2 can be viewed as 64-bit numbers for computing.
Step 6. With H 1 and H 2 , we calculate x 1 = ( H 1 / 10 15 ) % 1 and p = ( ( H 1 / 10 15 ) % 1 ) / 2 .
Step 7. Then, x 1 and p are fed into the PWLCM function to generate a sequence, where ( H × W × 8 ) / 2 = ( 12 × 10 × 8 ) / 2 = 480 numbers are generated. Each of them is multiplied by 10 15 , modulared with 8, achieving results with a rule sequence containing 480 numbers.
Step 8. We further match 960 bits of original data with rule sequence, where we match every 2 bits of data with 1 rule number based on DNA mapping rules in Table 1. After converting, we could obtain results as a DNA hash-encoded sequence, which would be sent to the content-aware encryption module for permutation and diffusion.

3.3. Content-Aware Encryption Module

The content-aware encryption enhancing module is designed to reorganize the data structure by highly non-linear functions, originating from correlations between adjacent pixels and patches. It is noted that DNA operations could vary to form more diversified expressions, thus greatly improving the variability of encrypted sequences. Moreover, the inherent complexity of DNA operations can be enhanced by utilizing the relevance between neighboring pixels, borrowing non-linear equations from neighboring pixels and patches. Therefore, the proposed module is designed to naturally involve the complexity of the image, greatly boosting the difficulty of the cracking.
We demonstrate the structure design of the proposed module in Figure 4, where the DNA-encoded sequence and rule selection sequence are regarded as inputs for the module. Essentially, we design a reversible permutation and diffusion algorithm to combine both forms of complexity for better unbreakability. Both algorithms could be directly applied on the input image without additional transmission cost via Internet or LAN. Furthermore, we have designed several computation operations that satisfy the commutative law, namely ADD, SUB and XOR, which not only ensures the variance of DNA sequences, but also shares the same parameters to reduce unnecessary transmission costs in LAN.
Specifically, we describe the calculation process of the DNA Sequence Permutation algorithm in Algorithm 3, which is built on the following four parameters:
d x 1 d t = x n + 1 = a ( y n x n ) + w n d y 1 d t = c x n y n x n z n d z 1 d t = x n y n b n z n d w 1 d t = y n z n + γ w n
where a, b, c and γ are preset parameters equaling 10, 3 / 8 , 28 and [ 1.52 , 0.06 ] , respectively. It is noted that such a calculation process ensures the chaos property of the proposed module. Afterwards, four parameters are sent into the Hyper Chaotic Lorenz System (HCLS) to generate the permutation control sequence Q p , where HCLS is a highly nonlinear dynamical system, being sensitive to the initial values for unpredictability.
Algorithm 3: DNA Sequence Permutation Process
Input: Initial Key K, DNA Encoded Sequence Q 1
Output: DNA Permutation Sequence Q 1 p
1   T A = DNA ADD Table;
2   T X = DNA XOR Table;
3   l e n g t h = Length ( Q 1 ) ;
4   A R = Q 1 ( 0 ) ; X R = Q 1 ( 0 ) ;
5   For (i = 1 to  l e n g t h );
6     A R = T A ( A R , Q 1 ( i ) ) ;
7     X R = T X ( X R , Q 1 ( i ) ) ;
8   H A S H D = SHA256( [ A R , X R ] );
9   H A S H K = SHA256(K);
10   H A S H D K = H A S H D H A S H K ;
11   A 1 = H A S H D K ( 0 : 63 ) ; A 2 = H A S H D K ( 64 : 127 ) ; A 3 = H A S H D K ( 128 : 191 ) ; A 4 = H A S H D K ( 192 : 255 ) ;
12   x 1 = mod fix A 1 / 10 8 , 80 40 + A 1 / 10 14 f i x A 1 / 10 14 ;
13   y 1 = mod fix A 2 / 10 8 , 80 40 + A 2 / 10 14 f i x A 2 / 10 14 ;
14   z 1 = mod fix A 3 / 10 8 , 80 + 1 + A 3 / 10 14 f i x A 3 / 10 14 ;
15   w 1 = mod fix A 4 / 10 8 , 500 250 + A 4 / 10 14 f i x A 4 / 10 14 ;
16   Put x 1 , y 1 , z 1 , w 1 into HCLS to generate a sequence X = [ x 1 , x 2 , . . . , x n ] by iterating;
17   Q p = m o d f l o o r X × 10 15 , l e n g t h ;
18   If (This is the encryption process);
19     i = 0 , j = l e n g t h / 2 ;
20   Else;
21     i = l e n g t h / 2 , j = 0 ;
22   For ( k = i  to j);
23     Q 1 ( Q p ( k ) Q 1 ( Q p ( l e n g t h k ) ;
24   Q 1 p = Q 1 ;
25   Output DNA Permutation Sequence Q 1 p ;
Similarly, we describe the calculation process of the DNA Sequence diffusion algorithm in Algorithm 4. Specifically, we first calculate key parameters X 1 and p based on values of H 1 and H 2 transmitted from the last module. Then, we input these parameters into the PWLCM algorithm to generate a diffusion control sequence. With the input rule selection sequence, we adopt DNA rules to map from numbers to DNA bases, thus generating DNA diffusion sequence. Finally, we apply DNA-based calculations on the generated permutation sequence and diffusion sequence, thus obtaining the merged sequence as the final output of the DNA permutation and diffusion sequence.  
Algorithm 4: DNA Sequence Diffusion Process
Input: Initial Key K, Rule Selection Sequence Q r u l e , Permutated Sequence Q 1 p
Output: Permutated and Diffused Sequence S 2
1   Convert the plain image I into a binary bitstream I b i t ;
2   length = Length ( S p ) ;
3   H A S H K = SHA256(K);
4   H 1 = H A S H K ( 128 : 191 ) ; H 2 = H A S H K ( 192 : 255 ) ;
5   x 1 = m o d f H 1 / 10 15 ;
6   p = m o d f H 2 / 10 15 ;
7   For (t = 0 to  l e n g t h / 2 );
8     x t + 1 = P W L C M ( x t , p ) ;
9   X = [ x 0 , x 1 , . . . , x l e n g t h / 2 ] ;
10   Y = m o d f l o o r X × 10 15 , 256 ;
11   T = DNA Encoding Table;
12   For (i = 0 to  l e n g t h / 2 );
13     S k e y ( i ) = T ( S r u l e ( i ) , Y ( 2 i , 2 i + 1 ) ) ;
14   T A = DNA ADD Operation Table;
15   T S = DNA SUB Operation Table;
16   T X = DNA XOR Operation Table;
17   If (in encryption process);
18     D ( 0 ) = T A ( Q p ( 0 ) , S k e y ( 0 ) ) ;
19     D ( 0 ) = T X ( D ( 0 ) , S k e y ( 0 ) ) ;
20    For (i = 0 to  l e n g t h );
21      If mod ( i , 2 ) = = 1 ;
22         D ( i ) = T X ( Q p ( i ) , S k e y ( i ) ) ; D ( i ) = T X ( D ( i ) , D ( i 1 ) ) ;
23      Else;
24         D ( i ) = T A ( Q p ( i ) , S k e y ( i ) ) ; D ( i ) = T X ( D ( i ) , D ( i 1 ) ) ;
25   Elif (in decryption process);
26    For (i = l e n g t h  to 0);
27      If mod ( i , 2 ) = = 1 ;
28         D ( i ) = T X ( Q p ( i ) , S k e y ( i ) ) ; D ( i ) = T X ( D ( i ) , Q p ( i 1 ) ) ;
29      Else;
30         D ( i ) = T A ( Q p ( i ) , Q p ( i ) ) ; D ( i ) = T X ( D ( i ) , S k e y ( i 1 ) ) ;
31       D ( 0 ) = T A ( Q p ( 0 ) , S k e y ( 0 ) ) ;
32       D ( 0 ) = T X ( D ( 0 ) , S k e y ( 0 ) ) ;
33   Q 2 = D ( 0 : l e n g t h 1 ) Output Permutated and Diffused Sequence Q 2 ;

4. Experiment and Analysis

We firstly introduce the experiment settings and implementation details. Then, we perform variants of the analysis to verify the resistance against different attacks. Afterwards, we perform ablation and computation analysis to evaluate performance. Finally, the comparison experiments are conducted.

4.1. Experiment Settings and Implementation Details

We deploy the proposed encryption system in TCP/IP environment. We connected two computers through the Tenda-AC71200M router, thus forming a simple wireless LAN environment. Specifically, the original image is provided by a laptop (sender) and encrypted into a cipher image by the proposed method. Then, the cipher image is transmitted to another laptop (receiver) via IP Messenger protocol and decrypted into a plain image.
It is noted that we use two computers with the same configurations to simulate the sender and receiver. Both computers are equipped with an Intel Core i5-12400F CPU, NVIDIA RTX 3060Ti GPU, and 16GB memory. Additionally, the encryption method is implemented based on Python 3.8, and the initial key is set to ‘GOOD-LUCK’.

4.2. Key Space Analysis

Key space is defined as the size of a key range, i.e., the number of keys, where different encryption algorithms have their own specific key space. Essentially, we should ensure that the key space is large enough to withstand brute force attacks. Specifically, we can calculate that the size of the key space of the proposed method is S = ( 0.5 × 10 15 ) 2 × ( 1 × 10 15 ) 2 × ( 80 × 10 14 ) 3 × ( 500 × 10 14 ) = 6.4 × 10 127 2 418 . Obviously, such a large key space ensures the capability to resist brute force attacks.

4.3. Histogram Analysis

The statistical analysis attack refers to the fact that attackers can obtain a quantity of information by analyzing the distribution of image pixel values. To verify the effectiveness of the proposed method against the statistical analysis attack, we compare the pixel value distribution of the original and cipher image. As shown in Figure 5a–e, the histogram of the original image fluctuates greatly, where attackers can easily construct effective attack strategies. Figure 5f–j shows the corresponding cipher images and pixel histograms, which proves that the encrypted image can effectively hide image information to resist statistical analysis attacks.

4.4. Pixel Correlation Analysis

Permutation and diffusion operations are used to scramble adjacent pixels between images, thus reducing the correlation between adjacent pixels and improving the security after image encryption. We can calculate the correlation coefficient between a and b to evaluate such correlation effects
r a b = cov ( a , b ) D ( a ) D ( b ) cov ( a , b ) = 1 N i = 1 N a i E ( a ) b i E ( b ) D ( a ) = 1 N i = 1 N a i E ( a ) 2 E ( a ) = 1 N i = 1 N a i
where cov ( a , b ) , D ( a ) and E ( a ) are defined as the covariance, mean square and expected error, respectively.
Table 2 shows the correlation coefficients of the plain and cipher image, where we can observe that the pixel correlation has been significantly reduced by comparing between both images. Correspondingly, Figure 6 shows the comparison of image correlation before and after encryption, which proves that the proposed method can effectively reduce the correlation in three directions.

4.5. Information Entropy Analysis

Information entropy is used to measure the uncertainty of data, where higher information entropy refers to larger complexity for cracking. Supposing the number of keys of an encryption algorithm is K-bit, the ideal information entropy should be K. To evaluate the uncertainty of the data, i.e., the diffusion performance, information entropy can be calculated as follows:
H = i = 1 256 p ( e i ) log 2 p ( e i )
where p ( e i ) represents the probability of the pixel being i.
The information entropy of five test images is 7.987421 (Poster), 7.996523 (Street), 7.989923 (Subway), 7.998615 (ID Card) and 7.988991 (Hohai University), where all the information entropy is close to 8, implying that the proposed method performs a pixel diffusion with an optimized performance.

4.6. Sensitivity Analysis

By modifying values of a few pixels and comparing results, differential attacks could help attackers to easily obtain the rules of encryption. Therefore, the cryptosystem is required to have a certain sensitivity to resist pixel modifications. We adopt a unified average changing intensity (UACI) and number of pixels change rate (NPCR) to measure such sensitivity:
N P C R = 1 H × W i = 1 H j = 1 W D i j × 100 % U A C I = 1 H × W i = 1 H j = 1 W I ( i , j ) I ( i , j ) 255 × 100 %
where D i j = 1 , I ( i , j ) I ( i , j ) 0 , I ( i , j ) = I ( i , j ) . I and I are the original and the modified image, respectively.
As shown in Figure 7, we choose an 8-bit image as the plain image and use the initial key ’GOOD-LUCK’ to encrypt the image, obtaining the ’pseudo initialize factor’ ( x 1 = 0.401894441844344 ,   p = 0.33533929244635197 ) . Afterwards, we change the pseudo-initialized factor to generate a new cipher image E 0 . Moreover, we define x 1 = x 1 + 10 14 and p = p + 10 14 to generate another two cipher images E 2 and E 3 .
The average NPCR and UACI values for different images are shown in Table 3. In fact, Wu et al. [26] state that the expected UACI value should be 33.4635% for an image with ranging values from 0 to 255. It is noted that all results are close to the expected UACI values, which proves that the proposed is capable of resisting differential attacks.

4.7. Ablation Analysis

To verify the effectiveness of the proposed content-aware encryption module, we make an ablation analysis with “Lena” image as input, which is considered as the most commonly used test image [27]. As shown in Table 4, the performance without the proposed module is relatively poor, since simply adopting DNA encoding without content modeling fails in encoding as muchinformation of the input image. In fact, the proposed content-aware encryption module uses a permutation and a diffusion process to describe informative information remaining in the encoded data, greatly improving the complexity for breaking.

4.8. Comparison Experiments

For comparative experiments, we follow the rules in Wu et al. [27], which are currently used by the vast majority of image encryption articles. Table 5 shows the experimental results with the comparing methods. It’s noted that results achieved by other methods are directly obtained from their papers.
Essentially, correlation refers to the capability of resistance to statistical attack. Information entropy represents the capability of resistance to entropy attack; meanwhile, sensitivity represents the capability of resistance to the differential attack. It can be observed from Table 5 that the proposed method cannot achieve the best performance on all measurements. For example, Zhang et al. [23] has the best performance in correlation, but the worst in NPCR. Such a phenomenon means their method cannot bear a differential attack. Aouissaoui et al. [28] has the best performance in NPCR, but the worst in entropy and correlation. Such an observation means it would fail under an entropy attack and statistical attack. The proposed method has achieved a balanced performance in three measurements, which represents it does not have as much weaknesses as the other two comparison methods by obtaining enough capability of resistance to any type of attacks. Therefore, it can be concluded that our method is competitive among these methods.

4.9. Computation Cost Analysis

We compare the computing cost of the proposed method and other DNA computing-based methods in Table 6, thus proving its relatively low computing burden. It’s noted that we use color image with 1024 × 1024 as input. All programs are deployed with C language and tested on the same devices (two laptops with i7-9750H CPU and 8GB DDR3 RAM), thus ensuring the fairness of comparisons. It is noted that the encryption and decryption process would cost 0.491 s and 0.507 s with the proposed method, which has certain advantages when comparing to other DNA computing-based methods.

5. Conclusions

The proposed method consists of two modules, i.e., DNA hash encoding and content-aware encrypting module. Specifically, the former one builds the quantity of hash mappings from image pixels to DNA computing bases, thus integrating the advantages of the hash function and DNA computing. The latter one considers strong correlations between adjacent pixels as sources of complexity, thus reorganizing the data structure by highly non-linear functions extracted from neighboring pixels and patches. Experimental results demonstrate that the proposed method could achieve a superior performance in various security measurements, compared with several of the latest comparison methods. Our future work includes DNA computing design on medical images a.

Author Contributions

Conceptualization, H.L. and L.Z.; methodology, H.L. and L.Z.; software, H.C.; validation, H.L., L.Z. and L.Z.; formal analysis, Y.W.; investigation, Y.W.; resources, H.L.; data curation, L.Z.; writing—original draft preparation, H.L. and L.Z.; writing—review and editing, H.L. and Y.W.; visualization, H.L. and L.Z.; supervision, Y.W.; project administration, Y.W.; funding acquisition, H.L. and Y.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Provincial Ideological and Political Education Research Projects in the Education Department of Zhejiang Province, the Fundamental Research Funds for the Central Universities under Grant B220202074, the Fundamental Research Funds for the Central Universities, JLU.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Wu, Y.; Cao, H.; Yang, G.; Lu, T.; Wan, S. Digital Twin of Intelligent Small Surface Defect Detection with Cyber-Manufacturing Systems. ACM Trans. Internet Technol. 2022. [Google Scholar] [CrossRef]
  2. Shu, J.J.; Wang, Q.W.; Yong, K.Y. DNA-based computing of strategic assignment problems. Phys. Rev. Lett. 2011, 106, 188702. [Google Scholar] [CrossRef]
  3. Adleman, L.M. Molecular computation of solutions to combinatorial problems. Science 1994, 266, 1021–1024. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  4. Zhang, C.; Wang, Z.; Liu, Y.; Yang, J.; Zhang, X.; Li, Y.; Pan, L.; Ke, Y.; Yan, H. Nicking-assisted reactant recycle to implement entropy-driven DNA circuit. J. Am. Chem. Soc. 2019, 141, 17189–17197. [Google Scholar] [CrossRef] [PubMed]
  5. Yang, J.; Wu, R.; Li, Y.; Wang, Z.; Pan, L.; Zhang, Q.; Lu, Z.; Zhang, C. Entropy-driven DNA logic circuits regulated by DNAzyme. Nucleic Acids Res. 2018, 46, 8532–8541. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  6. Zhang, C.; Zhao, Y.; Xu, X.; Xu, R.; Li, H.; Teng, X.; Du, Y.; Miao, Y.; Lin, H.C.; Han, D. Cancer diagnosis with DNA molecular computation. Nat. Nanotechnol. 2020, 15, 709–715. [Google Scholar] [CrossRef]
  7. Ma, Q.; Zhang, C.; Zhang, M.; Han, D.; Tan, W. DNA Computing: Principle, Construction, and Applications in Intelligent Diagnostics. Small Struct. 2021, 2, 2100051. [Google Scholar] [CrossRef]
  8. Khan, F.; Ncube, C.; Ramasamy, L.K.; Kadry, S.N.; Nam, Y. A Digital DNA Sequencing Engine for Ransomware Detection Using Machine Learning. IEEE Access 2020, 8, 119710–119719. [Google Scholar] [CrossRef]
  9. Zou, C.; Wei, X.; Zhang, Q.; Zhou, C.; Zhou, S. Encryption algorithm based on DNA strand displacement and DNA sequence operation. IEEE Trans. Nanobiosci. 2021, 20, 223–234. [Google Scholar] [CrossRef]
  10. Namasudra, S. Fast and Secure Data Accessing by Using DNA Computing for the Cloud Environment. IEEE Trans. Serv. Comput. 2022, 15, 2289–2300. [Google Scholar] [CrossRef]
  11. Song, T.; Eshra, A.; Shah, S.; Bui, H.; Fu, D.; Yang, M.; Mokhtar, R.; Reif, J. Fast and compact DNA logic circuits based on single-stranded gates using strand-displacing polymerase. Nat. Nanotechnol. 2019, 14, 1075–1081. [Google Scholar] [CrossRef]
  12. Wang, F.; Lv, H.; Li, Q.; Li, J.; Zhang, X.; Shi, J.; Wang, L.; Fan, C. Implementing digital computing with DNA-based switching circuits. Nat. Commun. 2020, 11, 121. [Google Scholar] [CrossRef] [Green Version]
  13. Thubagere, A.J.; Li, W.; Johnson, R.F.; Chen, Z.; Doroudi, S.; Lee, Y.L.; Izatt, G.; Wittman, S.; Srinivas, N.; Woods, D.; et al. A cargo-sorting DNA robot. Science 2017, 357, eaan6558. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  14. Liu, L.; Jiang, D.; Wang, X.; Zhang, L.; Rong, X. A Dynamic Triple-Image Encryption Scheme Based on Chaos, S-Box and Image Compressing. IEEE Access 2020, 8, 210382–210399. [Google Scholar]
  15. Xiao, Y.; Chen, Y.; Long, C.; Shi, J.; Ma, J.; He, J. A novel hybrid secure method based on DNA encoding encryption and spiral scrambling in chaotic OFDM-PON. IEEE Photonics J. 2020, 12, 1–15. [Google Scholar] [CrossRef]
  16. Wu, Y.; Guo, H.; Chakraborty, C.; Khosravi, M.; Berretti, S.; Wan, S. Edge Computing Driven Low-Light Image Dynamic Enhancement for Object Detection. IEEE Trans. Netw. Sci. Eng. 2022, 1. [Google Scholar] [CrossRef]
  17. Babaei, M. A novel text and image encryption method based on chaos theory and DNA computing. Nat. Comput. 2013, 12, 101–107. [Google Scholar] [CrossRef]
  18. Wang, X.; Liu, C. A novel and effective image encryption algorithm based on chaos and DNA encoding. Multim. Tools Appl. 2017, 76, 6229–6245. [Google Scholar] [CrossRef]
  19. Samiullah, M.; Aslam, W.; Nazir, H.; Lali, M.I.U.; Shahzad, B.; Mufti, M.R.; Afzal, H. An Image Encryption Scheme Based on DNA Computing and Multiple Chaotic Systems. IEEE Access 2020, 8, 25650–25663. [Google Scholar] [CrossRef]
  20. Malik, M.G.A.; Bashir, Z.; Iqbal, N.; Imtiaz, M.A. Color Image Encryption Algorithm Based on Hyper-Chaos and DNA Computing. IEEE Access 2020, 8, 88093–88107. [Google Scholar] [CrossRef]
  21. Khan, J.S.; Boulila, W.; Ahmad, J.; Rubaiee, S.; Rehman, A.U.; Alroobaea, R.; Buchanan, W.J. DNA and Plaintext Dependent Chaotic Visual Selective Image Encryption. IEEE Access 2020, 8, 159732–159744. [Google Scholar] [CrossRef]
  22. Ravichandran, D.; Banu, S.A.; Murthy, B.K.; Balasubramanian, V.; Fathima, S.; Amirtharajan, R. An efficient medical image encryption using hybrid DNA computing and chaos in transform domain. Med. Biol. Eng. Comput. 2021, 59, 589–605. [Google Scholar] [CrossRef] [PubMed]
  23. Zhang, Q.; Han, J.; Ye, Y. Multi-image encryption algorithm based on image hash, bit-plane decomposition and dynamic DNA coding. IET Image Process. 2021, 15, 885–896. [Google Scholar] [CrossRef]
  24. Wu, Y.; Zhang, L.; Berretti, S.; Wan, S. Medical Image Encryption by Content-Aware DNA Computing for Secure Healthcare. IEEE Trans. Ind. Inform. 2023, 19, 2089–2098. [Google Scholar] [CrossRef]
  25. Chen, J.; Zhu, Z.; Zhang, L.; Zhang, Y.; Yang, B. Exploiting self-adaptive permutation-diffusion and DNA random encoding for secure and efficient image encryption. Signal Process. 2018, 142, 340–353. [Google Scholar] [CrossRef]
  26. Wu, Y.; Noonan, J.P.; Agaian, S. NPCR and UACI randomness tests for image encryption. Cyber J. Multidiscip. J. Sci. Technol. J. Sel. Areas Telecommun. (JSAT) 2011, 1, 31–38. [Google Scholar]
  27. Wu, Y.; Zhou, Y.; Noonan, J.P.; Agaian, S. Design of image cipher using latin squares. Inf. Sci. 2014, 264, 317–339. [Google Scholar] [CrossRef] [Green Version]
  28. Aouissaoui, I.; Bakir, T.; Sakly, A. Robustly correlated key-medical image for DNA-chaos based encryption. IET Image Process. 2021, 15, 2770–2786. [Google Scholar] [CrossRef]
  29. Yan, X.; Wang, X.; Xian, Y. Chaotic image encryption algorithm based on arithmetic sequence scrambling model and DNA encoding operation. Multim. Tools Appl. 2021, 80, 10949–10983. [Google Scholar] [CrossRef]
Figure 1. The overall structure of the proposed method, including sender and receiver. They both contain a DNA hash encoding module and a DNA decoding module. In fact, content-aware decryption module can be regarded as the inverse version of content-aware encryption module.
Figure 1. The overall structure of the proposed method, including sender and receiver. They both contain a DNA hash encoding module and a DNA decoding module. In fact, content-aware decryption module can be regarded as the inverse version of content-aware encryption module.
Applsci 13 08509 g001
Figure 2. Encoding process inside DNA hash encoding module.
Figure 2. Encoding process inside DNA hash encoding module.
Applsci 13 08509 g002
Figure 3. An example of DNA hash encoding by inputting an image with size 8 × 8 .
Figure 3. An example of DNA hash encoding by inputting an image with size 8 × 8 .
Applsci 13 08509 g003
Figure 4. Structure design of the proposed content-aware encryption module.
Figure 4. Structure design of the proposed content-aware encryption module.
Applsci 13 08509 g004
Figure 5. The corresponding histograms for different plain and cipher images, where (af) are input plain images of ‘Lena’, ‘Poster’, ‘Street’, ‘Subway’, ‘ID Card’, ‘Hohai University’, and (gl) are their corresponding cipher images.
Figure 5. The corresponding histograms for different plain and cipher images, where (af) are input plain images of ‘Lena’, ‘Poster’, ‘Street’, ‘Subway’, ‘ID Card’, ‘Hohai University’, and (gl) are their corresponding cipher images.
Applsci 13 08509 g005
Figure 6. Correlation coefficients distributions of ‘Lena’ (a) and its corresponding cipher image (e), where (b,f) are distributions in horizontal direction, (c,g) are distributions in vertical direction, and (d,h) are distributions in diagonal direction.
Figure 6. Correlation coefficients distributions of ‘Lena’ (a) and its corresponding cipher image (e), where (b,f) are distributions in horizontal direction, (c,g) are distributions in vertical direction, and (d,h) are distributions in diagonal direction.
Applsci 13 08509 g006
Figure 7. We demonstrate differential cipher images achieved by the proposed method, offering samples on sensitivity and key sensitivity analysis.
Figure 7. We demonstrate differential cipher images achieved by the proposed method, offering samples on sensitivity and key sensitivity analysis.
Applsci 13 08509 g007
Table 1. DNA-based binary encoding rules, which uses different rules to represent binary values with DNA bases.
Table 1. DNA-based binary encoding rules, which uses different rules to represent binary values with DNA bases.
Rule 1Rule 2Rule 3Rule 4Rule 5Rule 6Rule 7Rule 8
A0000111110011001
C1001100100001111
G0110011011110000
T1111000001100110
Table 2. Results of correlation coefficients analysis on several testing images.
Table 2. Results of correlation coefficients analysis on several testing images.
ImagesPlain ImageCipher Image
VHDVHD
Baboon0.88130.75240.76380.00390.00370.0048
Bridge0.93440.95310.9812−0.00890.0049−0.0017
Chest0.96740.98920.9816−0.00370.0045−0.0081
Lena0.98320.97290.96310.00170.00260.0033
Hohai University0.86810.87240.9076−0.0018−0.00890.0094
Table 3. Results of NPCR and UACI achieved by the proposed method to evaluate sensitivity against differential attacks.
Table 3. Results of NPCR and UACI achieved by the proposed method to evaluate sensitivity against differential attacks.
ImagesNPCRUACI
Poster99.673233.4836
Street99.589033.4821
Subway99.601633.5104
ID Card99.623233.4302
Hohai University99.627833.4886
Key: E 1 E 2 99.598233.3821
Key: E 1 E 3 99.610733.4442
Key: E 2 E 3 99.519833.4250
Table 4. Results of ablation analysis on “Lena” image, where CAEM indicates content-aware encryption module.
Table 4. Results of ablation analysis on “Lena” image, where CAEM indicates content-aware encryption module.
Ablation MethodsCorrelationEntropySensitivity
VHDNPCRUACI
Ours (without CAEM)0.14250.09860.04837.014593.214332.4218
Ours (Full)0.00320.00190.00047.998299.644233.4732
Table 5. Results achieved by the proposed method and several comparison methods.
Table 5. Results achieved by the proposed method and several comparison methods.
CryptosystemsCorrelationEntropySensitivity
VHDNPCRUACI
Ours0.00320.00190.00047.998299.644233.4732
Chen et al. [25]−0.00640.00030.01107.999399.621833.5084
Zhang et al. [23]0.0000016−0.000003−0.0000001-99.500933.4408
Aouissaoui et al. [28]0.02400.0014−0.00147.997899.655233.5871
Yan et al. [29]−0.0056−0.0012−0.00207.999499.6233.55
Table 6. Computation cost comparisons among the proposed method and several DNA computing-based methods.
Table 6. Computation cost comparisons among the proposed method and several DNA computing-based methods.
CryptosystemsEncryption TimeDecryption Time
Ours0.491 s0.507 s
Chen et al. [25]0.525 s0.534 s
Zhang et al. [23]0.572 s0.568 s
Aouissaoui et al. [28]0.554 s0.549 s
Yan et al. [29]0.598 s0.602 s
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Li, H.; Zhang, L.; Cao, H.; Wu, Y. Hash Based DNA Computing Algorithm for Image Encryption. Appl. Sci. 2023, 13, 8509. https://doi.org/10.3390/app13148509

AMA Style

Li H, Zhang L, Cao H, Wu Y. Hash Based DNA Computing Algorithm for Image Encryption. Applied Sciences. 2023; 13(14):8509. https://doi.org/10.3390/app13148509

Chicago/Turabian Style

Li, Hongming, Lilai Zhang, Hao Cao, and Yirui Wu. 2023. "Hash Based DNA Computing Algorithm for Image Encryption" Applied Sciences 13, no. 14: 8509. https://doi.org/10.3390/app13148509

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop