# A Dynamic Sliding Window Encoding for Secured DNA Data Storage Compliant With Biological and Indexing Constraints

Chloé Berton, Gouenou Coatrieux, Héléne Gasnier, Sahar Haddad, Reda Bellafqira, Dominique Lavenier

<figure><img src="image_1.png" /></figure>

## ► To cite this version:

Chloé Berton, Gouenou Coatrieux, Héléne Gasnier, Sahar Haddad, Reda Bellafqira, et al. A Dynamic Sliding Window Encoding for Secured DNA Data Storage Compliant With Biological and Indexing Constraints. IEEE Access, 2025, 13, pp.66009-66030. 10.1109/ACCESS.2025.3560387. hal-05067257

HAL Id: hal-05067257

https://hal.science/hal-05067257v1

Submitted on 14 May 2025

HAL is a multi-disciplinary open access archive for the deposit and dissemination of scientific research documents, whether they are published or not. The documents may come from teaching and research institutions in France or abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est destinée au dépôt et à la diffusion de documents scientifiques de niveau recherche, publiés ou non, émanant des établissements d'enseignement et de recherche français ou étrangers, des laboratoires publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Received 21 February 2025, accepted 6 April 2025, date of publication 14 April 2025, date of current version 22 April 2025.

Digital Object Identifier 10.1109/ACCESS.2025.3560387

RESEARCH ARTICLE

# A Dynamic Sliding Window Encoding for Secured DNA Data Storage Compliant With Biological and Indexing Constraints

CHLOÉ BERTON<fnref n="1" />, GOUENOU COATRIEUX<fnref n="1" />, (Senior Member, IEEE), HÉLÉNE GASNIER<fnref n="1" />, SAHAR HADDAD<fnref n="2" />, REDA BELLAFQIRA<fnref n="1" />, (Member, IEEE), AND DOMINIQUE LAVENIER<fnref n="1" />,<fnref n="3" />

Corresponding author: Chloé Berton (chloe.berton@imt-atlantique.fr)

This work was supported in part by French Government supported to the Labex CominLabs and managed by Agence Nationale de la Recherche (ANR) through the “Investing for the Future” Program under Grant ANR-10-LABX-07-01, and in part by France 2030 Program under Grant ANR-22-PEXM-0005 and Grant ANR-24-CE39-3908.

**ABSTRACT** In this paper, we propose a novel dynamic sliding window encoding to store encrypted data in DNA form, taking into account biological constraints (G-C content and homopolymers) and prohibited nucleotide motifs used for data indexing. The originality of our approach is twofold. First, it is based on a new dynamic encoding (DE) which takes advantage of variable-length DNA codewords to encode binary data while avoiding homopolymers longer than *N* bases. Second, DE is combined with a sliding window strategy to detect whether a prohibited motif is about to appear. In such cases, our method inserts a non-coding base into the sequence to prevent the encoding of the motif. Unlike existing schemes, our approach scales extremely easily for high values of homopolymers and of prohibited motifs. It is furthermore independent of the cryptosystem. We provide the theoretical information rate of our proposal for a given number of prohibited motifs and a maximum homopolymer length. In general, it offers significantly higher performances, particularly in terms of information rate, than existing schemes while maintaining G-C content within the desired range with extremely high probability. Moreover, experiments conducted with a recent DNA storage chain simulator show that our method requires a similar amount of sequence copies as other encoding strategies for error-free DNA sequence recovery.

**INDEX TERMS** Confidentiality, DNA data storage, dynamic encoding, variable length DNA codewords.

## I. INTRODUCTION

For several years now, world digital data production has been growing exponentially. From 33 ZB of data in 2018, it is envisioned to reach 394 ZB [1] in 2028 (1 ZB corresponds to $10^{21}$ bytes). Addressing the challenge of storing all these data is becoming essential. Current electronic technologies, such as flash memory and hard disk drives, are reaching their limits, particularly in terms of density, energy and environmental costs, and sustainability [2]. Their lifespan is five to twenty years maximum, and their limited capacity of

about $10^{12}$ bytes is no longer sufficient. Due to these reasons, data storage on deoxyribonucleic acid (DNA) molecules has recently shown great promise [2], [3]. Indeed, DNA data storage could be a million times denser than hard disks, with $10^{17}$ bytes per gram of DNA. It also offers a 100 times longer lifespan and near-zero energy consumption, since molecules can be stored at room temperature without maintenance.

Moreover, emerging research topics relating to DNA data storage have recently shown promising results, for example DNA sequence analysis with Transformer-based models such as BERT [4], the *de novo* design of enzymes from scratch using a bottom-up approach [5], or the 2020 Nobel Prize for Chemistry awarded to the CRISPR-Cas9

The associate editor coordinating the review of this manuscript and approving it for publication was Byung-Gyu Kim.

<footnote n="1">¹IMT Atlantique, Unite INSERM 1101 Latim, Technopole Brest-Iroise, 29238 Brest, France</footnote>

<footnote n="2">²Wiketio, 92160 Antony, France</footnote>

<footnote n="3">³INRIA/IRISA, University of Rennes 1, 35042 Rennes, France</footnote>
genome-editing technique [6]. This last molecular tool enables DNA strands to be cut at precise points, thereby correcting a gene. Furthermore, Google Deepmind recently developed an AI system called AlphaFold [7] that predicts any protein's 3D structure from its amino acid sequence. These advances are proofs of the numerous recent investments in DNA related technologies.

The basic principle of DNA data storage is to transform digital data into synthetic DNA molecules. The storage process consists of three main steps: i) digital data are converted into DNA sequences (conversion from binary to DNA bases); ii) the sequences are synthesized into DNA molecules; iii) the DNA molecules are stored inside specific containers. To read back the data, the DNA molecules are sequenced, generating DNA sequences that are decoded to recover the original information. Fig. 1A summarizes these different operations.

DNA storage is a new technology. As a result, it is possible to incorporate the critical aspect of security as a central element. This is unlike what has been done for electronic storage devices. The work presented in this article specifically addresses this problem. It aims to secure data archived in DNA molecules, especially in terms of confidentiality in the entire storage chain. One must be aware that in the storage model presented in Fig. 1A, data confidentiality is at risk at all stages. An unauthorized user can spy on the sequencing [8] or synthesis [9] device, or secretly clone/steal the stored DNA molecules. We therefore add an encryption/decryption step to the chain as shown in Fig. 1B.

Data encryption can be performed on binary data or data in other base encodings. However, constraints in terms of the indexing of DNA molecules as well as those related to the synthesis and sequencing technologies must be considered when converting or encoding encrypted data into nucleotides. Indeed, cryptosystems convert clear data into an encrypted bitstream that is a uniformly distributed sequence of bits. It is impossible to predict the outcome of a cryptosystem. In consequence, there is a risk that, when encoded in nucleotides or in base-4, an encrypted bitstream will lead to a DNA sequence that does not comply with the imposed constraints. Such constraints come from different sources. The first ones deal with G-C content. It must be controlled in each subpart of a sequence, not just in the whole. A very uneven proportion of G-C and A-T bases can cause dropout (missing bases) [10] during sequencing and errors during polymerase chain reaction (PCR) amplification [11]. Furthermore, in the case where the sequence synthesis process depends on the assembly of small DNA sequences, i.e. with the objective of generating long DNA molecules, the sequences to be assembled must be close in terms of G-C content. Thus, the G-C content of the DNA may be higher than that of the base DNA and must be balanced within a certain range. A second constraint relies on polymers. Both the synthesis and sequencing processes are sensitive to homopolymers. The longer they are, the higher the probability of generating errors. Unlike genome sequencing where the size of the

<table><caption>TABLE 1. Goldman Encoding - Conversion table of ternary symbols (0, 1, 2) into DNA bases (A, C, G, T), originally proposed in [12].</caption><thead><tr><th>Previous DNA base</th><th>0</th><th>1</th><th>2</th></tr></thead><tbody><tr><th>A</th><td>T</td><td>C</td><td>G</td></tr><tr><th>C</th><td>A</td><td>T</td><td>G</td></tr><tr><th>G</th><td>A</td><td>T</td><td>C</td></tr><tr><th>T</th><td>A</td><td>C</td><td>G</td></tr></tbody></table>

homopolymers are imposed by the structure of the genomes, here we have complete control over the nature of the synthetic sequences. Thus, the generation of long homopolymers can be avoided to optimize both the synthesis and sequencing steps.

Another important constraint is the unwanted presence of certain motifs in the synthetic sequences. Synthesis is currently constrained to generating oligonucleotides, i.e. DNA sequences of a size smaller than 200 bases. Consequently, a digital file must be divided into multiple short DNA sequences, each sequence containing an index that indicates its position in the file. Each sequence is framed by primers, which are usually 18 to 30 bases long. These primers are unique to a sequence or group of sequences associated with the same file, for instance. These primers can thus be used to select a subset of sequences before sequencing. If a primer is unexpectedly found in the middle of a sequence, only part of the sequence will be amplified, and the data will be lost. Therefore, these short sequences, i.e. primers, should not be in the part of a DNA sequence that encodes the user's data. There would be a risk of losing part of the information, with the molecule selection process forgetting part of the molecule.

To sum up, there is a strong need to propose a solution to encode data in molecules or DNA sequences that take these different biological constraints into account. In the sequel, we review existing encoding methods that have been proposed to meet these biological constraints, before refining the originality of our proposal.

## A. RELATED WORKS

Biological constraints have been considered in encoding solutions in different ways. In the following, we propose to consider three main classes of methods depending on the constraints they consider simultaneously.

### 1) METHODS CONSIDERING A SINGLE BIOLOGICAL CONSTRAINT

These methods take into account a maximum homopolymer size [12] or control the G-C content [13]. In [12], data are encoded with no homopolymers of any size. To do so, binary data blocks are first converted to ternary blocks (i.e. in base 3) using a Huffman code. Each symbol in base-3 is then encoded into a DNA base using the Goldman encoding based on the dictionary from Table 1. As can be seen, this solution encodes a symbol in a DNA base that is always different from the previous base. Doing so, this encoding
<figure><img src="image_3.png" /><figcaption>FIGURE 1. DNA storage chain.A. Cleared storage chain.B. Encryption storage chain.</figcaption></figure>

considers a maximal homopolymer length of $N = 1$. In [14], such encoding has been generalized for longer values of $N$, following a strategy where Table 1 restricting the possible DNA bases is used only sometimes. More clearly, a Shannon-Fano code is first used to convert fixed-length binary blocks to variable-length codewords containing symbols in bases 3 and 4. Then, symbols from each codeword are encoded using two dictionaries alternatively. In particular, the first $N-1$ symbols are encoded using the classical encoding method, which associates a quaternary symbol with one of the 4 DNA bases. Then, the $N^{th}$ symbol, which is a ternary symbol, is encoded using the dictionary from Table 1. The latter breaks any homopolymer of size longer than $N$. In Section II, we will see that the dynamic encoding we propose differs from these strategies. In particular, it does not include a data compression strategy or base changes, but only a direct encoding from binary data to DNA codewords.

On its side, [13] focuses on the constraint of the G-C content. Input data are encoded into DNA using a dictionary of DNA codewords. The dictionary contains words of $p$ nucleotides, the content of which satisfies a balanced G-C. To do so, codewords of Varshamov-Tenengolts codes [15] are generated with added prefixes and suffixes that help balance the G-C content of the codeword. Then each codeword is associated to a message of $v$ bits.

As depicted, these methods only consider either a controlled G-C content or a maximal homopolymer length. However, these two constraints must be considered at once to correctly recover data written into DNA molecules using PCR and sequencing technologies.

## 2) METHODS CONSIDERING HOMOPOLYMER AND G-C CONTENT CONSTRAINTS

Several solutions have been proposed to encode data into DNA considering both a maximal homopolymer size and controlled G-C content constraints.

Some first methods only consider a fixed maximal homopolymer length. In [16], the authors present the first

large-scale architecture to store data into DNA molecules. This approach relies on the encoding of each bit value 0 into a nucleotide A or C, and each bit value 1 into a base T or G, to ensure a G-C content of 50%. The encoding relies on two steps: a bitstream is first encoded into a DNA sequence by randomly associating each bit to one of the two possible DNA bases. Then, the second step relies on scanning the obtained DNA sequence. When more than 3 nucleotides in a row are the same, the 4th nucleotide is switched to the other nucleotide corresponding to the same bit value (A with C, and G with T).

In [17], a dictionary of fixed-length DNA codewords is created so that each DNA codeword has a maximal homopolymer size of 3 bases, a G-C content of 40-60%, and codeword concatenation does not create long homopolymers. An iterative method is used to create all DNA codewords, by concatenation of smaller DNA codewords with these constraints.

In [18], authors construct dictionaries of DNA codewords from 8 to 12 bases, with a G-C content of 40-60% and homopolymers of length limited to 3 bases. The dictionary is built using a finite state transition diagram with 4 transition symbols corresponding to the 4 DNA bases (i.e. A, C, G, T). Going from one state of the transition diagram to another helps to control the occurrence of homopolymers and also maintains a balanced G-C content. Authors of [19] encode encrypted data with a controlled G-C content and maximal homopolymer size of 3 bases. Basically, they first encrypt binary data using the AES cryptosystem parameterized by a biometric key generated from the personal genetic information of a user. The resulting bitstream is converted into a base-47 encoded sequence. Next, they apply an inner and an outer Reed-Solomon error-correction code [20] to the data. The base-47 encoding allows converting two bytes into three base-47 elements, each element is then associated in a dictionary to a DNA codeword of 3 bases. These 3-base DNA codewords have been selected such that their two last DNA bases differ. By doing so, homopolymers of length greater than 3 are avoided. In [21], constraints of
<table><caption>FIGURE 2. Comparison of methods from the state-of-the-art and the proposed Dynamic Sliding Window Encoding “DSWE” scheme. A fixed and variable homopolymer indicates if a fixed or variable maximal homopolymer size constraint has been considered or not, respectively.</caption><thead><tr><th rowspan="2">Class</th><th rowspan="2">Method</th><th colspan="3">Homopolymers</th><th rowspan="2">Controlled G-C content</th><th rowspan="2">Encryption</th><th rowspan="2">Forbidden motifs</th></tr><tr><th>fixed</th><th>variable</th></tr></thead><tbody><tr><td rowspan="4">Methods with one biological constraint</td><td>Cai [139]</td><td></td><td></td><td>X</td><td></td><td></td><td></td></tr><tr><td>Goldman [18]</td><td>X</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Mishra [144]</td><td>X</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Pic [140]</td><td>X</td><td>X</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="15">Methods with two biological constraints</td><td>Church [17]</td><td>X</td><td></td><td>X</td><td></td><td></td><td></td></tr><tr><td>Li [143]</td><td>X</td><td></td><td>X</td><td></td><td></td><td></td></tr><tr><td>Song [142]</td><td>X</td><td></td><td>X</td><td></td><td></td><td></td></tr><tr><td>Wang [36]</td><td>X</td><td></td><td>X</td><td></td><td></td><td></td></tr><tr><td>Dimopoulou [145]</td><td>X</td><td></td><td>X</td><td></td><td></td><td></td></tr><tr><td>Zhao</td><td>X</td><td></td><td>X</td><td></td><td></td><td></td></tr><tr><td>Rasool</td><td>X</td><td></td><td></td><td></td><td></td><td>X</td></tr><tr><td>Yazdi</td><td></td><td></td><td>X</td><td></td><td></td><td>X</td></tr><tr><td>Grass [39]</td><td>X</td><td></td><td>X</td><td>X</td><td></td><td></td></tr><tr><td>Erlich [35]</td><td>X</td><td>X</td><td>X</td><td></td><td></td><td></td></tr><tr><td>Zan</td><td>X</td><td>X</td><td>X</td><td></td><td></td><td></td></tr><tr><td>Nguyen [148]</td><td>X</td><td>X</td><td>X</td><td></td><td></td><td></td></tr><tr><td>Press [151]</td><td>X</td><td>X</td><td>X</td><td></td><td></td><td></td></tr><tr><td rowspan="3">Methods with three biological constraints</td><td>Wei</td><td>X</td><td></td><td>X</td><td></td><td></td><td>X</td></tr><tr><td>Lochel [38]</td><td>X</td><td>X</td><td>X</td><td></td><td></td><td>X</td></tr><tr><td>Proposed method</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr></tbody></table>

no homopolymers and a G-C content of exactly 50% are guaranteed by alternating A and T bases at even positions and G and C bases at uneven positions in DNA codewords. To do so, two bits are encoded into two bases. Additionally, a Levenshtein code adds parity bits to correct an error in a DNA codeword. Due to the encoding structure alternating bases, at least 2 errors can be detected in one DNA codeword as long as they are not consecutive.

The scheme from [22] uses minimum variance Huffman trees to convert binary data into DNA codewords in a compressed manner. These codewords contain no homopolymer and demonstrate a G-C content close to 50%. The method starts by dividing input binary data into fixed-length blocks. These ones are then used to create two minimum variance Huffman trees $T$ and $T'$. A DNA base is associated to each edge of a tree, in a way that avoids DNA base repetitions. For example, the tree $T$ is constructed as follows: if a leaf is at an odd distance from the root, its left and right edges are labeled A and T, respectively. On the other side, if the leaf is at an even distance, they are labeled G and C, respectively. The complementary tree $T'$ is constructed with the opposite

instructions, with A and T labels for leaves at an even distance from the root. To encode binary data, if the last encoded base is G or C the tree $T$ is used; or the tree $T'$ in the other case. Thus, this encoding scheme ensures that no homopolymer is created. Furthermore, it ensures that the G-C content of the encoded sequence is close to 50%.

On its side, JPEG-DNA has been proposed to encode images in DNA molecules. It is an image compression scheme inspired by the JPEG standard, that creates DNA codewords with a maximal homopolymer size $N = 3$. As in JPEG, the encoding begins with a discrete cosine transformation, calculated on blocks of $8 \times 8$ pixels. Then, the new blocks are quantified using a uniform scalar quantization, before calculating differential encoding on DC coefficients, and reading the AC coefficients in a “zigzag” order. Then, the entropy encoding applied to coefficients by JPEG-DNA differs from that of JPEG. Indeed, coefficients are encoded directly into DNA codewords. First, the value of a coefficient is encoded using a PAIRCODE [23] dictionary $D_c$. This one limits homopolymers to 3 bases and guarantees a balanced G-C content. The dictionary $D_c$ is chosen depending on the value’s interval or category c. Then, this category is encoded with the method from [12]. First, binary data are converted into base-3 blocks with a ternary Huffman tree. Then, each symbol in base 3 is encoded into a DNA base using the dictionary 1. Using this table guarantees no homopolymer in the output DNA sequence. Both the encoded category and value of the coefficient are then concatenated to the already encoded DNA sequence.

In [24], a dictionary of DNA codewords is constructed, such that homopolymers are limited to 4 bases and that complementary subsequences are limited to 2 bases. This latter constraint guarantees that a DNA strand does not fold onto itself, forming a secondary structure that can be difficult to read. DNA codewords are constructed using the set $\Sigma = \{AA, CC, AC, CA, TC\}$. Such pairs are chosen to avoid the creation of complementary subsequences in codewords. Then, a non-surjective mapping takes as input each codeword and flips some DNA bases to avoid homopolymers longer than 4 bases. Only DNA codewords with no complementary subsequences are added to the dictionary. Note that this construction method relies on creating a dictionary of DNA codewords without long complementary subsequences but does not consider prohibited motifs a priori.

In [25], a graph-based De Bruijn Trim Rotation Graph encoding scheme is presented, to limit the homopolymer length to 2 bases and ensure a balanced G-C content. To do so, a dynamic binary sequence that respects the constraint rules is XOR-ed with the binary message to encode, in an iterative process encoding 6 bits at a time. The obtained sub-sequences of 6 bits are entered in a De Bruijn Trim graph, in which data are compressed. To balance the proportion of bases, repeating base pairs in connected nodes are deleted. To limit the size of homopolymers to 2 bases, the rotating tree algorithm can be modified.
The previous approaches have been proposed for only one maximal homopolymer size value *N* and have not been generalized. However, the value of *N* changes depending on the type of the sequencing technologies, also knowing that *N* tends to increase with their evolution [10]. It is thus important to create an encoding solution that can be adapted for several values of *N*. To achieve this objective, the DNA Fountain algorithm proposed in [26] employs the Luby Transform (LT) iteratively. This process, combined with a screening test, converts a block of bits into a DNA sequence characterized by balanced G-C content and the absence of homopolymers. To summarize, the first step, namely the Luby Transform, utilizes a random seed that varies with each iteration, generating a different binary sequence that encodes the information. On its side, the screening test verifies whether the binary block converted into DNA base-4 validates the biological constraints. If not, the LT is applied again. The encoding method proposed in [27] proposes a code construction of DNA codewords with a maximum homopolymer size *N* and a G-C proportion within [0.5 - ε, 0.5 + ε], for any ε and *N*. First, fixed-length codewords with a maximal homopolymer length are constructed with the sequence replacement technique. This algorithm removes iteratively all forbidden homopolymers from a codeword and inserts special subsequences in predefined positions to indicate where DNA bases were removed. Then, these codewords are modified using a generalized version of Knuth's balancing technique. This method flips the values of some DNA bases to balance the G-C content of codewords. Additionally, this solution includes the addition of a Varshamov-Tenengolts error-correcting code that can correct one error. In [28], binary streams are encoded into DNA sequences with a limited homopolymer size, a controlled G-C content, and no secondary structures in DNA molecules. To do so, the encoding relies on three steps. Binary data are first segmented into fixed-length indexed segments. Then, two segments are randomly selected to be incorporated into one DNA sequence according to a "Yin-Yang Codex" method. Finally, the DNA sequence is screened against pre-set constraints. If the DNA sequence does not meet these criteria, the iterative process is initiated. A new randomly generated binary segment will be encoded with the initially selected segment until a valid DNA sequence is produced. For some input binary data, this method can cause problems as generating a valid DNA sequence is difficult or impossible. This method does not consider prohibited motifs *a priori*. In [29], data are encoded into DNA sequences using an inner and an outer error-correcting code. The inner code works as follows to encode a binary sequence *S* into a DNA sequence *D*. First, a pseudo-random DNA sequence *D*₁...*D*ₙ is generated via a hash function with some parts of the binary sequence data. Then, each DNA base *D*ᵢ is encoded into *C*ᵢ such that *C*ᵢ = *D*ᵢ + *b*ᵢ*modC*, with *b*ᵢ the data bit from the input binary sequence. *C* is the number of allowed values the DNA base *C*ᵢ can take. For example, to avoid a AAAA homopolymer, the

value *A* can be forbidden at this position, and thus, *C* = 3. The outer code is a Reed-Solomon code, which allows the reconstruction of DNA sequences that could not be corrected with the inner code. In [30], a modulation-based method starts with the encoding of each bit into one DNA base. To do so, similarly to the method from [16], a bit value 0 from the bitstream *S* is encoded either into a base *A* or *C*, and a bit value 1 into a *T* or a *G*. To decide which base encodes a bit, two parameters are considered: the value *S*(*i*) of the *i*th bit of the bitstream *S*, and the value *K*(*i*), i.e. the *i*th bit of a modulating bitstream *K*. For example, if *S*(*i*) = 0, the encoded base is an *A* in case *K*(*i*) = 0, or a *C* when *K*(*i*) = 1. The modulating bitstream *K* has a balanced proportion of bits 0 and 1, to control the G-C content, as well as a maximal repetition *N* of the same bit to avoid homopolymers longer than *N* bases. Furthermore, the modulating bitstream consists in a repeat of a few bits pattern, useful to detect insertion and deletion errors at the decoding step.

To our knowledge, the solution mCGR presented in [31] is the first to consider prohibited motifs as a constraint during encoding along with balanced G-C content and homopolymer size constraints. This encoding is presented in the next Section I-A3.

However, some methods consider two encoding constraints including avoiding the generation of codewords that are also primers, or the appearance of a few specific prohibited motifs.

One method [32] relies on an encoding that avoids homopolymers longer than 2 bases and motifs from the dictionary $P_m = \{ATG, TAA, TGA, TAG, TGG\}$. To do so, they rely on two dictionaries that encode one or two bits into one DNA base, depending on the two last encoded DNA bases. This method also relies on an optimization algorithm that determines optimal DNA sequences through an iterative process. Such sequences have a minimized risk to hybridize to themselves or each other. To sum up, the encoding method avoids the appearance of homopolymers longer than 2 bases and of 5 3-bases motifs, by constructing specific encoding dictionaries. However no generalization is proposed on the number or size of prohibited motifs.

Another method [33] relies on the construction of DNA primers, i.e. sequences framing a codeword used for DNA molecules selection, that are different from DNA codewords encoding data. To do so, all weakly mutually correlated (WMU) sequences of a fixed size are determined. These sequences are generated so that no sufficiently long suffix of one sequence is the prefix of the same or another sequence. Some of the sequences are used as primers, while the rest are DNA codewords that can encode data. WMU sequences are generated with several constraints: they must be at large mutual Hamming distance from each other, have balanced compositions of DNA bases, and avoid primer-dimer byproducts. This last constraint consists in avoiding the hybridization of two sequences to each other, caused by sequences with complementary bases in the primers. These products should be avoided as they could
lead to amplification problems during PCR. Note that the homopolymer constraint is not considered in this article. To build the dictionary of DNA codewords, binary sequences with the same amount of bits 0 and 1 are encoded into DNA codewords with the following encoding: the value 0 is encoded into either a A or a T, and the value 1 is encoded into a C or a G. Thus, the G-C content of each DNA codeword is of 50%. To sum up, this method relies on the generation of codewords with the same size as the primers. In consequence, this method can only prohibit motifs of the same size as the primers'.

### 3) METHODS WITH G-C CONTENT, HOMOPOLYMER, AND PROHIBITED MOTIFS CONSTRAINTS

In [34], a collision aware code is developed, to encode a binary sequence into a DNA sequence with no homopolymers, a balanced G-C content, and no collisions with primers from a 20-bases sequences dictionary. To do so, binary triplets are first associated to four DNA triplets according to a DNA triplet mapping table. Then, one of the four DNA triplets is selected, by looking at the 17 previously encoded DNA bases. The choice is based on the strongest collision reduction pattern between the 20-bases DNA sequence and primers from the dictionary. This method has been specifically designed to avoid the appearance of 20-bases primers in DNA sequences encoding data, and is not adapted to consider other sizes of forbidden motifs.

Let us now describe the solution mCGR presented in [31]. This encoding method considers prohibited motifs as a constraint during encoding as well as a balanced G-C content and a maximal homopolymer size.

The strategy of mCGR consists of building a dictionary that associates to a fixed length block of information bits a fixed length base-4/DNA codeword. To create this dictionary, they follow a “fractal” strategy to go across the base-4 codeword space, to avoid testing all codewords. They retain DNA codewords that satisfy the homopolymer and balance G-C content constraints, also testing if a selected codeword is not a prohibited motif. To be sure that concatenated words also respect the constraints, they post-process the dictionary of codewords to remove all codewords beginning and ending with at least half of a prohibited motif or a long homopolymer. Compared to [26], this encoding method is much faster. However, due to the removal of many DNA codewords from the dictionary during post-processing, the information rate of this method significantly drops when the number of prohibited motifs increases. Moreover, as in [18] and [27], dictionary construction remains very complex, especially as the number and length of prohibited motifs increase.

### B. CONTRIBUTIONS

Fig. 2 sums up all the above methods according to the constraints they consider: a controlled G-C content, the use or not of an encryption module, the consideration of prohibited motifs, and the capability to manage different homopolymer lengths.

In this paper, we propose a novel approach for storing encrypted data in a DNA form while considering the three following constraints:

* A balanced G-C content

* A maximal homopolymer length *N*

* A number *M* of prohibited motifs

Its originality first stands on an encoding solution that converts binary data into DNA sequences of variable length using a set of dictionaries of small dimensions and, second, on an informed decoding strategy based on a sliding window. To be more precise, a binary block of fixed length is encoded into a variable length DNA sequence using a dictionary which is selected according to the last encoded DNA base to avoid homopolymers of maximal size *N*, in a process called the Dynamic Encoding (DE). Compared to other approaches, DE directly encodes binary data into DNA molecules. It does not include a compression step or prior encoding from binary to ternary. As it can be seen from Fig. 2, except mCGR [31], all other proposals do not consider prohibited motifs. To overcome this issue, we propose a Sliding Window Encoding. When a prohibited motif is about to appear in the DNA sequence, a non-coding base is added to the sequence. This base does not encode any information. To ensure that such a base does not interfere at the decoding stage, we take advantage of an “informed” decoder that repeats in part the encoding process to both identify which dictionary to use for decoding and detect non-coding bases. Beyond, our scheme is easy and flexible to adapt when changing the maximum homopolymer size *N*, contrarily to other encoding solutions that only consider one specific length, as depicted in Fig. 2. As we will see, it’s less complex than mCGR’s dictionary calculation; a method it outperforms in terms of information encoding rate as the number of prohibited motifs increases. As we will also see, our choice of dictionaries in DE also allows balancing the G-C content when input data are uniformly distributed. Going a step further, we will show that our strategy, applied to compressed rather than encrypted data, provides an information rate that is better than or at least equivalent to that of encoding methods based on compression algorithms such as Huffman [22] or JPEG [35].

The rest of this paper is organized as follows. We detail our Dynamic Sliding Window Encoding (DSWE) scheme in Section II. Section III is devoted to experimentation where we compare our solution to state-of-the-art methods. Before concluding, we discuss our proposal in Section IV.

## II. MATERIALS AND METHODS

In this Section, we first introduce the DNA storage chain we work with, along with the way data confidentiality can be ensured using cryptography, underlying how such encoding may interfere with biological constraints. We then present our Dynamic Sliding Window Encoding (DSWE), designed to avoid homopolymers longer than *N* bases and *M* prohibited DNA motifs used for data indexing.
# A. DNA STORAGE CHAIN AND DATA CONFIDENTIALITY

In this work, we consider the DNA data storage chain depicted in Fig. 1B, where blue components only handle digital data and green components correspond to biological processes. As can be seen, binary data are first encoded into nucleotide strings that are next synthesized into DNA molecules and stored. At the reading step, DNA molecules are selected and amplified by PCR and fed to a sequencing machine. Binary data are recovered in two steps: i) a post-processing consensus that takes as input multiple erroneous copies of a DNA sequence and produces a unique DNA sequence; ii) a decoding algorithm to convert the DNA nucleotides into binary data.

## 1) SIMULATED DNA STORAGE CHAIN

In this work, and for all our experiments, the biological functionalities are simulated using the simulator proposed in [36]. This one includes the DNA synthesis, storage, and sequencing processes implemented with the following technologies:

* Synthesis: The standard phosphoramidite chemistry is considered. Prior to synthesis, the DNA sequences are quality-controlled to ensure that they can be successfully synthesized.

* Storage: DNA molecules are stored in vitro, isolated by encapsulation from any damaging environmental factors such as humidity or oxygen.

* Sequencing: The nanopore sequencing technology is considered through MinION [37] devices available from Oxford Nanopore Technologies (ONT).

This simulator takes as input a DNA sequence flanked by primers, sequences of bases we will consider as prohibited motifs, and produces several copies of this sequence (simulating an amplification step, as presented in Section I). Such a sequence contains three types of nucleotide errors: insertion, deletion and substitution. For the post-processing of the consensus, we use the solution described in [38].

## 2) DATA ENCRYPTION AND BIOLOGICAL CONSTRAINTS

The data storage chain we just described has no security features. To ensure data confidentiality at each step of the chain, binary data can be encrypted (resp. decrypted) before its base-4 encoding (resp. after its base-4 decoding) as shown in Fig. 1B (red boxes). An encryption scheme maximizes entropy and outputs independent and uniformly distributed blocks of data. This means that one bit has an equal probability of being ‘0’ or ‘1’ and is independent from other ciphertext bits. To go further, a semantically secure encryption scheme can be chosen. For two identical plaintexts, it will always give two distinct ciphertexts. By using such an encryption algorithm, confidentiality is maintained even if the data is leaked during the sequencing or synthesis processes by applying for example the snooping attacks from [8], [9], or if the DNA molecules are stolen.

Let us define an encryption algorithm Enc, which takes input blocks of plaintext messages and encrypts them into ciphertext blocks using a cryptographic key, as presented below.

$$C_i = \text{Enc}(P_i, \text{IV}_i, K_{\text{Enc}}) \quad (1)$$

where: $P_i$ is the $i^{th}$ plaintext block of the message to encrypt, $\text{IV}_i$ is a random Initialization Vector, $C_i$ is the $i^{th}$ cipher block and $K_{\text{Enc}}$ is the encryption key.

In this work, for experimentation purposes, we have opted for the well-known Advanced Encryption Standard (AES) [39]. It was chosen by the National Institute of Standards and Technologies (NIST) and the National Security Agency (NSA) after a standardization process in 2001 to be the symmetric key algorithm of choice, which it still is today. AES is a block-cipher cryptosystem that encrypts a fixed-length plaintext block $P_i$ of 128-bits into a ciphertext $C_i$ of the same size with an encryption key of size 128, 192 or 256 bits, i.e. $C_i = \text{Enc}(P_i, K_{\text{AES}})$. To decrypt $C_i$, the AES algorithm works in a reverse way such as $P_i = \text{Dec}(C_i, K_{\text{AES}})$. AES is a light cipher in the sense it is of low complexity and does not require a lot of memory storage.

AES can operate in different standardized modes. We used the CBC (Cipher Block Chaining) [40] mode where an XOR (exclusive or) operation is done to each plaintext block with the result of the encryption of the previous block. A cipher block $C_i$ is obtained with the following operation:

$$C_i = \text{Enc}(P_i \oplus C_{i-1}, K_{\text{AES}}) \quad (2)$$

where: the operator $\oplus$ corresponds to the XOR operation; $P_i$ is the $i^{th}$ 128-bits plaintext block; $C_{i-1}$ is the previous 128-bits cipher block and $K_{\text{AES}}$ is the encryption key. To encrypt $P_1$ into $C_1$, the XOR operation is first done with a randomized initialization vector (IV) such that $C_1 = \text{Enc}(P_1 \oplus \text{IV}, K_{\text{AES}})$. Thus, with CBC, two identical plaintexts will give two distinct ciphertexts making AES-CBC semantically secure.

As AES outputs are independent and identically distributed 128-bit blocks, it is not possible to control the structure of encrypted data. In particular, if one applies a classical DNA encoding associating two bits to one DNA base, each of the nucleotide values {A, C, G, T} has a probability of 25% to appear at any position in a sequence. On one side, this will allow the preservation of the G-C content. However, a pair of nucleotides has a 25% chance to be a repetition of the same nucleotide value and the probability to generate from the encrypted bitstream a homopolymer of 3 or 4 bases are of 6.25% and 1.56%, respectively. These probabilities are non-negligible when encoding terabytes of encrypted data as envisioned with the DNA storage technology. Thus, to control the size of homopolymers and the appearance of prohibited motifs, encrypted data must be encoded using constrained DNA encoding, which we will describe in the following Section. Note that our encoding solution uses binary-to-DNA dictionaries chosen to preserve the uniform distribution of input data, and thus control the G-C content of encoded DNA sequences.
<figure><img src="image_4.png" /><figcaption>**FIGURE 3.** Dynamic Sliding Window Encoding (DSWE) of a binary block $S_i$. First, $S_i$ is encoded into a variable length DNA codeword $VLC_i$ using Dynamic Encoding (DE), taking into account the last encoded base $B^l$ of the DNA sequence $D_{DSWE}$, the maximal homopolymer size $N$ and the dictionaries $Dic_{N,Y}$, with $Y \in \{A, C, G, T\}$. Then, the Sliding Window Encoding (SWE) is applied leading to the addition or not of Non-Coding Bases (NCBs) to avoid prohibited motifs from the dictionary $P_m$. The resulting DNA codeword $D_{SWE}$ is concatenated to the already encoded DNA sequence $D_{DSWE}$.</figcaption></figure>

**Step 1: Classical encoding of all binary blocks**

<table><thead><tr><th>Binary blocks</th><th>Classical DNA codewords</th></tr></thead><tbody><tr><td>000000..</td><td>AAA..</td></tr><tr><td>000001..</td><td>AAc..</td></tr><tr><td>000010..</td><td>AT..</td></tr><tr><td>000011..</td><td>AAg..</td></tr><tr><td>000100..</td><td>ACA..</td></tr><tr><td>000101..</td><td>ACC..</td></tr><tr><td>000110..</td><td>ACT..</td></tr><tr><td>000111..</td><td>ACG..</td></tr><tr><td>001000..</td><td>ATA..</td></tr><tr><td>001001..</td><td>ATC..</td></tr><tr><td>001010..</td><td>ATT..</td></tr><tr><td>001011..</td><td>ATG..</td></tr><tr><td>...</td><td>...</td></tr></tbody></table>

**Step 2: Re-encoding of codewords beginning with AA and AC**

<table><caption>**FIGURE 4.** Construction of the dictionary $Dic_{N,A}$ in two steps. The first step consists in encoding all binary blocks into classical DNA codewords. The second step re-encodes some of these codewords so that none begins with multiple bases 'A'. More precisely, all codewords beginning with 'AA' and 'AC' are re-encoded, replacing their second base with either 'CG' or 'CT'. The obtained codewords are called variable-length DNA codewords.</caption><thead><tr><th>Binary blocks</th><th>V-L DNA codewords</th></tr></thead><tbody><tr><td>000000..</td><td>ACG..</td></tr><tr><td>000001..</td><td>ACGc..</td></tr><tr><td>000010..</td><td>ACGt..</td></tr><tr><td>000011..</td><td>ACGg..</td></tr><tr><td>000100..</td><td>ACTA..</td></tr><tr><td>000101..</td><td>ACTC..</td></tr><tr><td>000110..</td><td>ACTT..</td></tr><tr><td>000111..</td><td>ACTG..</td></tr><tr><td>001000..</td><td>ATA..</td></tr><tr><td>001001..</td><td>ATC..</td></tr><tr><td>001010..</td><td>ATT..</td></tr><tr><td>001011..</td><td>ATG..</td></tr><tr><td>...</td><td>...</td></tr></tbody></table>

## B. DYNAMIC SLIDING WINDOW ENCODING (DSWE)

As depicted in Fig. 3, our Dynamic Sliding Window Encoding (DSWE) scheme consists of applying iteratively two variable-length DNA encodings we propose the Dynamic Encoding (DE) and the Sliding Window Encoding (SWE), described in the following sections. Let us recall that DE and SWE are useful for avoiding homopolymers of a given maximum size $N$ and the occurrence of $M$ prohibited motifs of $m$ nucleotides stored in a dictionary $P_m$, respectively.

### 1) DYNAMIC ENCODING (DE) WITH DICTIONARIES

The basic idea of our Dynamic Encoding (DE) solution is to directly convert binary data into base-4 DNA codewords while avoiding homopolymers longer than $N$ bases. Our encoding solution is designed to optimize the information rate, i.e. the number of bits encoded in a DNA base. To do so, fixed-size binary blocks are encoded into variable length DNA codewords. The choice of a DNA codeword to encode a binary message depends on the last DNA base of the previously encoded DNA codeword.

This principle was also proposed in several methods presented in the last section. In [12], binary blocks are first

compressed to obtain ternary blocks. Each symbol in base-3 is then encoded into a DNA base, whose value is chosen to always be different from the last encoded DNA base. This way, no homopolymers are created (i.e. $N = 1$). The dictionary used for this encoding is presented in Table 1. A generalization of this method is presented in [14] for longer values of $N$, encoding compressed ternary and quaternary symbols by using the dictionaries from Table 1 and the classical encoding. Both of these methods encode DNA bases depending on the last encoded DNA base. However, they rely on a compression step, while we enhance this principle by proposing a direct dynamic encoding method, from binary to DNA.

In our case, DE relies on the use of four DNA dictionaries or dictionaries the use of which depends on the last encoded base, i.e. $\{(A, C, G, T)\}$. Each dictionary contains variable length (VL) DNA codewords that have been designed in such a way that, if concatenated with the last encoded DNA base, it is not possible to generate a homopolymer of size greater than $N$. Each dictionary allows encoding the same number of messages; i.e. in the case of a message of $u$ bits to encode, each dictionary contains $2^u$ DNA codewords. DE allows thus a direct binary to DNA encoding contrarily to other strategies [12], [14] that first apply a binary-to-ternary encoding followed by a Goldman encoding that converts ternary symbols in DNA bases.

In detail, our dynamic encoder works as follows. DE takes as input a binary sequence, it first divides it into binary blocks or messages $S_k$ of $2(N-1)$ bits; i.e. $S_k = (b_0^k b_1^k, \dots, b_{2(N-1)-1}^k)$. Then, it encodes each block $S_k$ into a VL DNA codeword $D_k$ of $N-1$ or $N$ nucleotides, i.e. $D_k = (B_0^k D_1^k, \dots, B_{N-2}^k D_{N-1}^k)$ or $(B_0^k B_1^k, \dots, B_{N-1}^k B_0^k)$. To do so, the dictionary $Dic_{N,B^l}$ is used, with $B^l$ the last encoded nucleotide; i.e. $Dic_{N,B^l}$ corresponds to one of the four dictionaries $Dic_{N,A}$, $Dic_{N,C}$, $Dic_{N,G}$ and $Dic_{N,T}$. The VL DNA codeword $D_k$ is then concatenated to the already encoded DNA sequence. Regarding the initialization of the encoding, that is to say, the encoding of the first DNA sequence base, we use the Classical DNA Encoding given in Fig. 6A. This one associates two bits to one base.

To explain how to build the dictionaries in general, let us consider the case of $Dic_{N,B^l=A}$. This dictionary is used to avoid more than $N$ repetitions of the nucleotide $A$ when encoding an input binary block of $2(N-1)$ bits.

A dictionary construction is done in two steps. The first step is the encoding of all blocks of $2(N-1)$ bits into $N-1$ DNA bases, using the classical DNA encoding. The
<figure><img src="image_5.png" /><figcaption>**FIGURE 5.** Re-encoding rules for the second step of a dictionary construction. At this step, some DNA codewords in dictionaries $Dic_{N,B^l}$ are re-encoded so that no codeword begins with $(B^l B^l)$. More precisely, for DNA codewords beginning with $B^l$ and a base in red, such red bases are re-encoded into bases in green, using $Dic_{N=2,B^l}$.</figcaption></figure>

obtained codewords are called classical DNA codewords. An example is given in Fig. 4 for the dictionary $Dic_{N,A}$. Here, the last encoded base is $B^l = A$, so our goal is to avoid $(A...A)$ homopolymers. In consequence, some classical DNA codewords beginning with a base A are re-encoded into variable-length (VL) DNA codewords. These codewords are built such that $B_0^k = A$ and $B_1^k \in \{C, G, T\}$. Thus, $B^l = A$ will not be repeated more than one time at the beginning of the codeword. To generate these VL DNA codewords, we want to ensure that no codeword is the prefix of another, so that decoding is done without ambiguity. We also want to respect the G-C content constraint. Thus, we propose a simple algorithm, using the four small dictionaries $Dic_{2,B^l}$ depicted in Fig. 6B in the case $N = 2$.

Simply, the second base of DNA codewords beginning with (AA) and (AC), i.e. bases A and C, will be replaced by the two bases CG and CT respectively, according to the dictionary $Dic_{2,A}$. This leads to DNA codewords beginning with (ACG) and (ACT), respectively. Replacing the second base of DNA codewords with two bases guarantees that no codeword will be the prefix of another while ensuring that no codeword begins with a A homopolymer, whatever the value of $N > 2$. Indeed, DNA codewords can end with homopolymers of at most $N - 1$ bases, but they will be concatenated with codewords the two first bases of which are different. This ensures that no homopolymers longer than $N$ are created when concatenating two variable-length DE-encoded DNA codewords. Rules for the re-encoding of classical DNA codewords to avoid homopolymers in dictionaries $Dic_{N,B^l}$ can be found in Fig. 5. This solution optimizes the length of DNA codewords, as most of them are encoded using classical DNA encoding. An example is shown in Fig. 7 for $N = 3$, the four dictionaries encode 4 bits into either classical DNA codewords of 2 bases or VL DNA codewords of 3 bases, in green and red boxes respectively.

Let us now explain our encoding solution for a maximum homopolymer length of $N = 3$, to avoid that more than three successive nucleotides in a sequence take the same value. To do so and as shown in Fig. 7, our dynamic encoder takes as input: a binary block $S_k$ of $2(N - 1) = 4$ bits and the

<figure><img src="image_6.png" /><figcaption>**FIGURE 6.** Dictionaries to encode DNA sequences to avoid homopolymers of size 2.A. Classical Encoding dictionary used to encode the first base of the DNA sequence.B. Dictionaries $Dic_{N=2,B^l}$ depending on the last base of the already encoded DNA sequence $B^l$. Framed in green are classically encoded DNA codewords, whereas codewords framed in red are re-encoded to avoid creating homopolymers.</figcaption></figure>

<figure><img src="image_7.png" /><figcaption>**FIGURE 7.** Dictionaries $Dic_{N=3,B^l}$ encoding 4 bits into variable length DNA codewords of 2 or 3 bases, for the case $N = 3$. Framed in green are classical DNA codewords, whereas variable length DNA codewords are framed in red.</figcaption></figure>

last DNA base $B^l$ of the already encoded DNA sequence. It outputs a DNA codeword $D_k$ of $N - 1 = 2$ or $N = 3$ bases, that is to say $D_k = (B_0^k B_1^k)$ or $D_k = (B_0^k B_1^k B_2^k)$, where $B_p^k \in \{A, C, G, T\}$. $D_k$ is next concatenated to the DNA sequence. $S_k$ is encoded into $D_k$ using $Dic_{3,B^l}$ among the four dictionaries $\{Dic_{3,A}, Dic_{3,C}, Dic_{3,G}, Dic_{3,T}\}$ given in Fig. 7. As it can be seen if $B^l = A$, the encoder will use the dictionary $Dic_{3,A}$, in which DNA codewords begin with at most one A. Respecting the same rule with other nucleotide values ensures that we will never encode a homopolymer of size greater than $N = 3$. The initialization of the encoded DNA sequence for the first base is done using the Classical DNA Encoding as given in Fig. 6A.

Fig. 8A presents an example of the DE encoding of a binary sequence $S = (0111000001)$ into a DNA sequence $D$ for $N = 3$. The first two bits of $S$, i.e. $(b_0^k b_1^k)$, are encoded with the Classical DNA Encoding. Then, the two following 4-bit blocks are encoded into VL DNA codewords using the dictionaries $Dic_{3,B^l}$. The resulting encoded DNA sequence is $D = (CGAACT)$. Fig. 8B provides the decoding of $D$. The first base of $D$ is decoded using the Classical DNA Encoding while the rest of the nucleotides are decoded using our informed dynamic decoder.

As stated in the general case above, the concatenation of VL DNA codewords will not induce homopolymers of size greater than 3. Indeed, let us consider the example where
<figure><img src="image_8.png" /><figcaption>FIGURE 8. Example of the Dynamic Encoding and Decoding with 4 dictionaries, for N = 3. Initialization is always done with Classical Encoding or Decoding. A. Encoding of a bit sequence S with dictionaries Dic$_{N=3,B^l}$ into a VL DNA codeword D. B. Decoding of a DNA codeword D with dictionaries Dic$_{N=3,B^l}$.</figcaption></figure>

<figure><img src="image_9.png" /></figure>

$B^l = A$ and two-bit blocks to encode such that: $S_k = (0101)$ and $S_{k+1} = (0101)$. $S_k$ and $S_{k+1}$ are encoded into $D_k = (CC)$ and $D_{k+1} = (CAG)$, respectively, and their concatenation will lead to a homopolymer of size 3, i.e. (CCCAG). This is due to the fact that the two first bases of the longest VL DNA codewords are always different. Note that the dictionaries used in Fig. 6B for $N = 2$ are an exception as they avoid any homopolymers. A dictionary Dic$_{2,B^l}$ never encodes a DNA codeword beginning with $B^l$, which allows these dictionaries to be used to generalize the Dynamic Encoding to greater values of $N$.

As we encode encrypted data, data which by definition are uniformly distributed (i.e., $Pr(b_i^k = 0) = Pr(b_i^k = 1) = \frac{1}{2}$), it is possible to estimate the average information rate $R$ of our strategy, that is to say the average number of bits of information encoded per DNA base (BPB). Based on this statement all blocks or messages of $2(N - 1)$ bits are equiprobable. It is consequently the same for each VL DNA codeword for all dictionaries. The average information rate can then be defined as:

$$R = \frac{|S_i|}{\sum_i p_i l_i} \text{BPB} \quad (3)$$

where: $|S_i|$ corresponds to the size in bits of the binary blocks $\{S_k\}$ (i.e. $|\{S_k\}| = 2(N - 1)$); $p_i$ and $l_i$ are the probability of occurrence and the size in bases of the $i^{th}$ variable length DNA codeword, respectively. For $N = 2$, with a binary block $S_k$ of 2 bits we have $p_i = 1/4$ and 2 VL DNA codewords of size 2 and 2 others of size 1, leading thus to an average information rate $R_{N=2} = 1.33$ BPB. For $N > 2$, whatever the DE dictionary, among the messages or blocks of $2(N - 1)$ bits, $\frac{7^{th}}{8}$ of them are encoded into codewords of $N - 1$ bases and the remaining $\frac{1^{th}}{8}$ into codewords of $N$ bases (see Fig. 5). The average information rate can then be defined as follows:

$$R_N = \frac{2(N - 1)}{\left(\frac{1}{8}N + \frac{7}{8}(N - 1)\right)} = \frac{16(N - 1)}{8N - 7} \quad (4)$$

For $N = 3$ we have $R_{N=3} = 1.882$ BPB. With such an encoding, we optimize the information rate as we preserve at best the Classical DNA Encoding. When $N$ tends to infinity $R$ tends to the ideal information rate of 2 BPB.

To go a step further, one can also calculate the worst information rate $R_{worst}$, obtained when DE encodes all information blocks with the longest VL DNA codewords, $l_{max} = N$, and which is given by:

$$R_{\text{worst}} = \frac{|S_k|}{l_{\text{max}}} = \frac{2(N - 1)}{N} \text{BPB} \quad (5)$$

In the case $N = 3$, $R_{worst,N=3}$ would be equal to $\frac{4}{3} = 1.33$ BPB, but such a case is very unlikely to happen.

In the same vein, the best information rate $R_{best}$, achieved when all selected VLC DNA codewords are of the shortest size $l_{min} = N - 1$, is such as:

$$R_{\text{best}} = \frac{|S_k|}{l_{\text{min}}} = \frac{2(N - 1)}{N - 1} = 2 \text{BPB} \quad (6)$$

We logically obtain the ideal information rate.

As a last remark, we would like to insist on the difference between our proposal with the solutions based on the combination of a binary-to-ternary encoding with the Goldman encoding as proposed in [12], [14] and [35]. These solutions use entropy encoding algorithms, such as the ones of Huffman or Shannon-Fano, to convert binary messages into ternary messages. These algorithms are devoted to lossless data compression. They build and use a look-up table of variable length codewords to encode binary messages of fixed length. This is the source of the variability in the size of the DNA sequences encoded with the approaches [12], [14], and [35]. These not only ternary encode data but also compress them. That is not the case with DE. These approaches encode data into a ternary, and then they apply the Goldman encoding, as it cannot be used to directly encode binary data. Indeed, as seen from Fig. 1, it does not respect the prefix code rule which requires that no codeword be the prefix
of another codeword. If this rule is not respected, ambiguities
appear during decoding. Let us take an example. Assume that
the last encoded base is A. The binary messages (00), (01)
and (10) are encoded by *T*, *C* and *G*, respectively. Regarding
the message (11), it will be encoded in two bases (*CT*). This
will cause an ambiguity at the decoding stage because this
one starts with the nucleotide *C* which also encodes (01).
The decoder will not know if he has to decode *CT* as (11)
or as (0101) (see Fig. 1). DE satisfies this prefix rule and can
thus be used to directly encode binary messages into a DNA
sequence, without using data compression. As we will see,
it can however encode compressed data leading to better or
equivalent performances than [12], [14], and [35] in terms of
information rate.

2) SLIDING WINDOW ENCODING (SWE)

The purpose of this Sliding Window Encoding scheme (SWE)
is to generate DNA sequences without creating prohibited
motifs, such as primers. We will explain in the next Section
how we combine it with Dynamic Encoding (DE) to also
avoid the generation of homopolymers longer than N.

Let us consider a binary sequence *S* that is progressively
converted into a DNA sequence *D* using conventional DNA
encoding (see Fig. 6A) and a dictionary *P*<sub>*m*</sub> which contains *M*
prohibited motifs of *m* nucleotides. Our objective is to avoid
such motifs occurring when adding to *D* a new base *B*<sub>*j*</sub>. To do
so, we propose to use a sliding window *W* to verify if the
previous *m* − 1 encoded nucleotides, i.e. (*B*<sub>*j*−1</sub> + ... + *B*<sub>*j*−1</sub>),
equal the *m* − 1 high order bases of one of the prohibited
motifs. More clearly, having the *u*<sup>*th*</sup> prohibited motif such
as *M*<sub>*u*</sub> = (*ATCGAT*) of size *m* = 6, its *m* − 1 high-order
bases correspond to (*ATCGA*). The sub-dictionary *P*<sub>*m*</sub>*W* is
created from *P*<sub>*m*</sub> by taking the *m* − 1 high order bases of each
motif in *P*<sub>*m*</sub>. Thus, if *W* does not correspond to an element
of *P*<sub>*m*</sub>*W*, then *B*<sub>*j*</sub> is concatenated to *D*. In the other case, *B*<sub>*j*</sub>
must take a nucleotide value to avoid the occurrence of a
non-authorized motif. We call such a base a non-coding base
(NCB). Once *B*<sub>*j*</sub> is added to *D*, the sliding window moves
forward one base. Notice that as long as a prohibited motif is
detected, a non-coding base is added. On its side, the decoder
will follow the same strategy. Before considering that the
value *B*<sub>*j*</sub> it observes encodes data, it will check if the previous
*m*-1 bases correspond to the first bases of a prohibited motif.
Such a strategy guarantees thus that some specific motifs do
not appear. As defined, SWE is also a dynamic encoding
approach as it produces DNA sequences of variable length.
A similar approach to our Sliding Window Encoding is used
in bit-stuffing algorithms [41], notably in communication
protocols, in which an arbitrary binary sequence is encoded
into a constrained binary sequence with a maximal number of
consecutive 0's (run-length-limited constraint). In particular,
a 1 is inserted after every run length of *k* 0's to limit its
size.

It is important to note that our approach constrains the
possible prohibited motifs. This is due to its reliance on

modifying the last base of a sequence consisting of *m*
bases. Let us consider *M* prohibited motifs of size *m*
(i.e., $M_u(u=1...M) = (B_0^u, ..., B_{m-2}^u, B_{m-1}^u)_{u=1...M}$). Once the
values of the *m*−1 high order bases $B_0^u, ..., B_{m-2}^u$ are fixed, one
can generate only three prohibited motifs so that $B_{m-1}^u$ can
take one non-coding value. This is the unique constraint SWE
imposes. In consequence, for a fixed size of *m* bases, up to
$3 \times 4^{m-1}$ prohibited motifs can be considered. However, when
one or several non-coding bases are added to avoid prohibited
motifs there is a risk to introduce a homopolymer of size
greater than *N*. To ensure that no homopolymer is created by
adding non-coding bases, DSWE imposes another constraint.
The non-coding base should also be different from $B_{m-2}^u$
to avoid the creation of a homopolymer. Here, for a given
sequence *m* − 1 high order bases, we have a fixed prohibited
motif $M_u^p = (B_0^u, ..., B_{m-2}^u, B_{m-1}^u = B_{m-2}^u)$ and three other
patterns two of which could be used as prohibited motifs the
last one being an authorized motif (the value of its last base
corresponds to a non-coding base value). To sum up, for a
fixed size of *m* bases, there can be up to 3 prohibited motifs
with the same *m* − 1 high order bases, with the constraint that
one of these motifs has the same two low order bases (i.e. $M_u$
such that $B_{m-1}^u = B_{m-2}^u$). In consequence, up to $3 \times 4^{m-1}$
prohibited motifs can be considered.

Beyond, the complexity of this solution depends on *M* and *m*. Indeed, the more numerous and the longer the prohibited motifs, the greater the number of tests to make and the greater the complexity is. Let us define the dictionary *P*<sub>*m*</sub>*W*, which contains all *m*−1 high order bases of the *M* prohibited motifs. To encode one base, |*P*<sub>*m*</sub>*W*| tests must be made, to compare the sliding window *W* to the elements of the sub-dictionary *P*<sub>*m*</sub>*W*. |*P*<sub>*m*</sub>*W*| sequences of *m*−1 bases must be followed by a non-coding base, so there is a probability of |*P*<sub>*m*</sub>*W*| / 4<sup>*m*−1</sup> that a base at any position in the DNA sequence is non-coding. If all prohibited motifs have distinct *m* − 1 high order bases, then this probability equals M / (4<sup>*m*−1</sup>).

3) DSWE ENCODING & DECODING

The basic principle of DSWE is given in Fig. 3. It encodes
a binary sequence *S* into a variable length DNA sequence
*D*<sub>DSWE</sub> using an iterative procedure that applies DE and SWE
encodings consecutively while considering the prohibition of
homopolymers greater than *N* bases and *M* prohibited motifs
of predefined size *m* stored in the dictionary *P*<sub>*m*</sub>.

Let us consider that DSWE is looking for the encod-
ing of a binary block $S_i$ of $2(N - 1)$ bits having
already encoded a DNA sequence of *d* bases: $D_{DSWE} =$
($D_{DSWE,0}$...$D_{DSWE,d-1}$). As it can be seen from Fig. 3,
the process begins with the Dynamic Encoding of $S_i$ into
a variable length DNA codeword VLC of size *N* or *N* −
1 nucleotides (see Section II-B1), using the dictionary
Dic<sub>N,B</sub> ∈ {Dic<sub>N,A</sub>, Dic<sub>N,C</sub>, Dic<sub>N,G</sub>, Dic<sub>N,T</sub>} with *B*<sup>l</sup> the last
encoded base of $D_{DSWE}$ (i.e. $D_{DSWE,d-1}$). Then, the second
step consists of the SWE encoding of VLC<sub>i</sub>, considering the
dictionary $P_m$. It outputs a variable length DNA sequence
$D_{SWE}$ where one or several Non-Coding Bases (NCB) may
have been added if necessary. The bases of $VLC_i$ are added to $D_{DSWE}$ one by one. Regarding the first base of $VLC_0$ of $VLC_i$, a sliding window $W$ is created with the last $m-1$ bases of $D_{DSWE}$. If the window does not match the $m-1$ high order bases of a motif from $P_m$, $VLC_0$ is added to $D_{DSWE}$, otherwise a non-coding base is concatenated to $D_{DSWE}$. The sliding window $W$ is shifted by one base to consider the last $m-1$ bases of $D_{DSWE}$ until all bases of $VLC_i$ have been added to $D_{DSWE}$. Regarding the initialization of DSWE, it is the same as for DE and SWE. The first two bits of $S$ are encoded with Classical DNA Encoding. Once the DNA sequence $D_{DSWE}$ is finalized, it is framed by primers and thus ready for synthesis. Let us recall that primers are part of the prohibited motifs. The full algorithm of this procedure is given in Annex A1.

The decoding DSWE process works in the reverse way. Let us consider DSWE is looking for the decoding of the $d^{th}$ base $D_d$ of the sequence $D_{DSWE}$, having already decoded $d-1$ bases from a DNA sequence $D_{DSWE}$ into a global binary sequence $S_{DSWD}$. To do so, the process starts by applying the SWE decoding taking as input the window $W$ that contains the $m-1$ bases preceding $D_d$ in $D_{DSWE}$. If $W$ does not correspond to the $m-1$ higher bases of one of the motifs of $P_m$ then $D_d$ is assumed to be a base of a VL DNA codeword. Such a codeword can be of $N$ or $N-1$ bases. Thus, once $VLC_j$ reaches the size $N-1$ or $N$, its DE decoding is applied, looking at the value of the base that precedes it in $D_{DSWE}$ (i.e. the base $B^l$ from the DSWE encoding point of view) to select the appropriate decoding dictionary (i.e. $Dic_{N,B^l}$). Finally, the output of the DNA codeword decoding, a binary block of $2(N-1)$ bits is concatenated to the DSWE-decoded sequence $S_{DSWD}$. Notice that, as for the DSWE encoding process, the first base of the DNA sequence $D_{DSWE}$ is decoded into two bits following the Classical DNA Encoding dictionary.

The theoretical information rate of DSWE depends on the DE encoding rate and thus of the maximal homopolymer length $N$ as well as on the number of non-coding bases added; a number that is also related to the dictionary $P_m$ with $M$ prohibited motifs of $m$ bases; and of the distribution of the data to store. Because we encode encrypted data that are uniformly distributed, the average information rate $R_{DSWE}$ of DSWE is then given by:

$$R_{DSWE} = P_{B_j} \times R_N = \left(1 - \frac{|P_{mW}|}{4^{m-1}}\right) \times R_N \quad (7)$$

where: $R_N$ is the Dynamic Encoding information rate for a maximal homopolymer size $N$ (see Eq. 4); $|P_{mW}|$ is the number of prohibited motifs with distinct $m-1$ high order bases; and, $P_{B_j}$ the probability the base $B_j$ is a data-encoding nucleotide. Indeed, $B_j$ is a non-coding base if it is preceded by the $m-1$ high order bases of a prohibited motif. There are $|P_{mW}|$ different sequences corresponding to the $M$ prohibited motifs, so the probability that a sequence of $m-1$ bases is in $P_{mW}$ is of $\frac{|P_{mW}|}{4^{m-1}}$.

Note that the proposed solution as well as all experiments do not include an error-correction code, as solutions proposed in [21], [27], [29], and [42].

It would be typically applied on the binary encrypted data, just before DSWE encoding, adding thus some information overhead.

### III. RESULTS

#### A. IMPLEMENTATION

We implemented our algorithms in Python3 (version 3.8.10), using a laptop (Intel Celeron 3205U, 4GB RAM, 2 cores CPU 1.5 GHz).

Our dataset consists of the well-known test image “Lena.png” of 48 Kbytes, a random *lorem ipsum* text of 95 Kbytes as well as the pdf files of two scientific articles: [19] and [36]. Text files have been used to evaluate the information rates, the G-C content, and the error rates, the image was used to benchmark the runtimes of the encoding processes.

The implemented benchmark is the following: Data were first encrypted 5 times using 5 distinct AES-256 keys in CBC mode.

Then, each of the 5 encrypted bitstreams was separated into 10000 fixed sized binary sequences of $X$ bits, with $X \in \{100, 200, 1000, 2000\}$, separately encoded into DNA sequences using our DSWE encoder. Obtained sequences were provided to the simulator from [36] to evaluate the required number of copies to retrieve data error-free. Our DSWE scheme was implemented considering the parameters' values $N = \{2, 3, 4\}$, and a dictionary $P_m$ with $M = \{0, 10, 20, 30, 40, 50, 60, 70, 76\}$ prohibited motifs of $m=6$ nucleotides. The global dictionary $P_m$ contains 76 prohibited motifs of distinct $m-1$ high order bases. Such motifs have been chosen by decomposing a set of primers of 18 or 24 bases into motifs of 6 bases. Notice that for the sake of simplicity, the following notation $DSWE(N, M, m)$ is used to indicate the parameterization of our encoding scheme. Therefore, the following results are given on average.

We compared our solution to state-of-the-art methods described in Section I-A in terms of information rate. We also did a thorough comparison to the concurrent method mCGR [31], using information rate, runtime, and DNA sequence recovery performances. Let us recall that mCGR generates dictionaries of DNA codewords of size $l$ considering three types of constraints: a fixed G-C content or in an interval; homopolymers of maximum size $N$; and a list of prohibited motifs of up to $l$ bases. To our knowledge, mCGR is the only other existing work considering prohibited motifs. We use its publicly available implementation considering: a G-C content balance of 40-60%; a maximum homopolymer size of $N=3$; and the generation of a dictionary with DNA codewords of 10 nucleotides. A dictionary of 12 bases is proposed in mCGR. However, based on the fact mCGR relies on a dictionary cleaning operation with as its purpose the removal of codewords the concatenation of which could lead to the creation of homopolymers or prohibited motifs,
the difference between the dictionaries in the case of 10 and 12 bases is negligible. This is the reason why we did not consider this parameterization in the following.

## B. EXPERIMENTAL RESULTS

In this Section, we experimentally demonstrate the performance of DSWE in terms of information rates and G-C content.

### 1) INFORMATION RATE

We evaluate the performance of the Dynamic Sliding Window Encoding (DSWE) and compare its theoretical average information rate $R_{DSWE}^T$ (cf. Equation 7) to the experimental one considering three maximal homopolymer sizes $N \in \{2, 3, 4\}$ and two values of $M \in [0, 76]$. The experimental information rate $R_{DSWE}^E$ we calculate is the mean value of the information rates obtained for all encoded sequences. It is expressed in bits per base (BPB) defined such as:

$$R_{DSWE}^E = \frac{\sum_{i=1}^{e} \frac{|S_i|}{|D_i|}}{e} \qquad (8)$$

where: $e$ is the number of blocks of the encrypted binary sequence to encode; $S_i$ is the $i^{th}$ binary block of this encrypted bitstream; $D_i$ is the DSWE-encoded DNA sequence of $S_i$; and, $|x|$ is the size operator in bits or nucleotides depending on if $x$ is a binary block or a DNA sequence, respectively.

Theoretical and experimental information rates are given in Table 2 depending on the maximal homopolymer length $N$ and the number $M$ of prohibited motifs. As it can be seen rates are very close. Such a result validates the hypothesis that: i) AES produces encrypted data uniformly distributed; a hypothesis we considered in the calculation of the theoretic information rate; ii) the DNA codewords from our dictionaries are generated in equal proportions, preserving input data distribution. One can however notice that a slight difference of 0.5% exists between theoretical and experimental rates. This can be explained by the fact that, when generating our dictionary of 76 prohibited motifs, we did not consider that they should have a uniform distribution of bases. Note that bigger values of $N$ guarantee a more stable average information rate with a smaller standard deviation.

To go further, we give in Fig. 9, the experimental information rates for values $N = 2, N = 3, N = 4$ and $N = 5$ for different numbers $M$ of prohibited motifs. It can be seen that this one decreases linearly with $M$. In the case DSWE works with $M = 76$ prohibited motifs, we have an information rate loss of 0.15 BPB on average compared to the case where $M = 0$. Anyway, even if DSWE causes some losses, it still preserves a dense average information rate, with most of the DNA sequences very close to the theoretical rate as shown by the small standard deviation values. It can also be observed that DSWE becomes effective for $N > 2$. At $N = 3$, it provides an information rate of 1.84 BPB to 1.73 BPB for 20 and 76 prohibited motifs, respectively. Moreover, DSWE preserves the uniform distribution of encrypted data

<table><caption>**TABLE 2.** Experimental $R_{DSWE(N,M,6)}^E$ and theoretical $R_{DSWE(N,M,6)}^T$ information rates of DSWE expressed in bits per base (BPB) depending on the maximal homopolymer size $N$ and the number $M$ of prohibited motifs of $m = 6$ nucleotides. Experimental rates are given on average with their standard deviation (std) in parenthesis.</caption><thead><tr><th>M</th><th>N</th><th>R<sup>E</sup><sub>DSWE(N,M,6)</sub> (std) in BPB</th><th>R<sup>T</sup><sub>DSWE(N,M,6)</sub> (in BPB)</th></tr></thead><tbody><tr><td rowspan="3">0</td><td>2</td><td>1.334 (0.015)</td><td>1.333</td></tr><tr><td>3</td><td>1.882 (0.010)</td><td>1.882</td></tr><tr><td>4</td><td>1.921 (0.008)</td><td>1.920</td></tr><tr><td rowspan="3">20</td><td>2</td><td>1.302 (0.017)</td><td>1.288</td></tr><tr><td>3</td><td>1.839 (0.011)</td><td>1.846</td></tr><tr><td>4</td><td>1.880 (0.010)</td><td>1.883</td></tr><tr><td rowspan="3">40</td><td>2</td><td>1.239 (0.019)</td><td>1.242</td></tr><tr><td>3</td><td>1.803 (0.011)</td><td>1.809</td></tr><tr><td>4</td><td>1.843 (0.011)</td><td>1.845</td></tr><tr><td rowspan="3">76</td><td>2</td><td>1.167 (0.020)</td><td>1.160</td></tr><tr><td>3</td><td>1.730 (0.013)</td><td>1.743</td></tr><tr><td>4</td><td>1.768 (0.011)</td><td>1.778</td></tr></tbody></table>

<figure><img src="image_10.png" /><figcaption>**FIGURE 9.** Theoretical and experimental information rates of DSWE(2, M, 6), DSWE(3, M, 6), DSWE(4, M, 6) and DSWE(5, M, 6). Experimental results are given in average in bits per base (BPB) along with their respective standard deviations, for 10⁴ sequences of 10³ bits and depending on the number $M$ of prohibited motifs.</figcaption></figure>

for any number $M$ of prohibited motifs, as we have been able to verify for several maximal homopolymer lengths $N$ ($N \in \{2, 3, 4, 5\}$).

### 2) G-C CONTENT

To be correctly synthesized and read, DNA sequences must have a balanced base rate, with a required 40% to 60% rate of G and C bases [10]. In this Section, we show that the DSWE encoding of encrypted data preserves a uniform distribution of bases and consequently such a balance.

As it can be seen from Table 3, the mean value of the G-C content is very close to 50% for all tested values of $N$ and $M$ with a standard deviation of 1.32 to 2.02%. All tested DNA sequences have a G-C content between 42.6 and 57%, with most sequences close to 50%. These results are consistent with requirements [10]. Additionally, the small standard deviation shows that changing the encryption key does not impact the G-C content as the uniform distribution is preserved. Notice that generated DNA sequences have a balanced A-C-G-T content in general due to the encoding of encrypted data.
<table><caption>**TABLE 3.** Average G-C content and standard deviation of DSWE-encoded DNA sequences depending on the number *M* of prohibited motifs. Results are given in percentage, for 10⁴ sequences of 10³ bits, with *M* ∈ {0, 20, 40, 76}, *N* = 3 and *m* = 6.</caption><thead><tr><th><i>M</i></th><th><i>N</i></th><th>Average G-C content (in %)</th><th>Standard deviation (in %)</th></tr></thead><tbody><tr><td rowspan="3">0</td><td>2</td><td>50.0</td><td>1.32</td></tr><tr><td>3</td><td>50.0</td><td>1.90</td></tr><tr><td>4</td><td>50.0</td><td>2.00</td></tr><tr><td rowspan="3">20</td><td>2</td><td>50.0</td><td>1.38</td></tr><tr><td>3</td><td>49.8</td><td>1.94</td></tr><tr><td>4</td><td>50.0</td><td>1.97</td></tr><tr><td rowspan="3">40</td><td>2</td><td>50.0</td><td>1.47</td></tr><tr><td>3</td><td>49.8</td><td>1.93</td></tr><tr><td>4</td><td>50.0</td><td>1.98</td></tr><tr><td rowspan="3">76</td><td>2</td><td>49.9</td><td>1.51</td></tr><tr><td>3</td><td>49.6</td><td>1.94</td></tr><tr><td>4</td><td>49.6</td><td>2.02</td></tr></tbody></table>

Furthermore, a balanced G-C content is achieved whatever the number *M* of prohibited motifs. For instance, the G-C content is of 49.8% for DSWE(*N*, *M*, *m*) = DSWE(3, 20, 6) and of 49.6% for DSWE(3, 76, 6). On average, the G-C content differs slightly depending on *M*. This difference can be explained by the fact that our dictionary of prohibited motifs does not contain DNA sequences with a uniform distribution of bases. This small change aside, using a Sliding Window Encoding, that is to say adding non-coding bases to prevent the appearance of prohibited motifs (see Section II-B2), does not impact the uniform distribution of bases in DNA sequences.

To go a step further, we also evaluated the G-C content in the case of short DNA sequences. Indeed, as reported in [10], DNA sequences containing regions of 100-200 bases with a G-C content less than 20% or more than 80% can cause sequencing problems. This is the reason why GeneArt String Assistant, an analysis tool that associates a synthesis complexity score to a given DNA sequence, rejects sequences with regions of 20 and more bases with unbalanced content in terms of A and T, or G and C, in particular regions with only A and T bases, or only G and C bases. The experiment we conducted to verify that our DSWE-encoded DNA sequences are compliant with these constraints is as follows. As such, the text [36] was encrypted with one AES-256 key, and the resulting encrypted bitstream separated into 10⁴ binary sequences of 100 bits and also into 10⁴ sequences of 40 bits. Then, these blocks were encoded into DNA sequences using DSWE(3, *M*, 6) for several values of *M*, *M* ∈ {20, ..., 76}. As it can be seen in Table 4, for sequences of 40 bits, DNA sequences are on average of length 21 bases, with a G-C content from 19% to 76% and an average of 49.6%. For sequences of 100 bits, the G-C content is between 30.2 to 68.0%, compliant with requirements. As a consequence, even for small DSWE-encoded DNA sequences the G-C content is controlled and within requirements.

To conclude, our DSWE encoding preserves a local and global balanced G-C content, for any maximal homopolymer

<table><caption>**TABLE 4.** G-C content for 10000 sequences of 40 and 100 bits encoded using DSWE(3, *M*, 6) for several values of *M*, *M* ∈ [20, ..., 76]. Results are given in percentage and in average.</caption><thead><tr><th></th><th>40 bits</th><th>100 bits</th></tr></thead><tbody><tr><td>Average base length (in bases)</td><td>21</td><td>53</td></tr><tr><td>Average G-C content (in %)</td><td>49.6</td><td>49.7</td></tr><tr><td>Minimum G-C content (in %)</td><td>19</td><td>30.2</td></tr><tr><td>First quartile (in %)</td><td>42.8</td><td>45.3</td></tr><tr><td>Third quartile (in %)</td><td>57</td><td>52.9</td></tr><tr><td>Maximum G-C content (in %)</td><td>76</td><td>68</td></tr></tbody></table>

size *N* and number of motifs *M*. With DSWE, the longer the DNA sequence, the more the balance converges towards 50% making it compliant with synthesis and sequencing constraints.

### 3) ALGORITHMIC COMPLEXITY

During our dynamic encoding DE, a codeword with *N* or *N* − 1 bases is encoded without creating homopolymers longer than *N* using a small dictionary search. Indeed, the first two bits of a word are encoded in one or two bases according to the dictionary *Dic*<sub>*N*=2</sub> shown in Figure 6B. Then, two bits are always encoded in one base according to the classical encoding (Figure 6A). Each dictionary is of size 4, giving a complexity of $\theta(4)$ per encoded base, so encoding a codeword of *N* bases is an operation of complexity $\theta(4N)$. A binary sequence of *b* bits therefore has a worst complexity of $\theta(4b)$.

The complexity of our sliding window encoding SWE depends on the number of bases to be encoded, the size *m* and the number *M* of forbidden motifs. Each window comparison at the start of a pattern of *m* − 1 bases has a complexity of $\theta(m-1)$. So, before each base addition, the set of comparisons has a complexity of $\theta(M(m-1))$. In total, for a word with *N* bases, the complexity is $\theta(NM(m-1))$. In general, for a sequence of *d* bases, the associated complexity is linear according to *d*: $\theta(dM(m-1))$. For a binary sequence of *b* input bits, the worst-case complexity is therefore $\theta(bM(m-1))$.

The complexity of DSWE is calculated from those of DE and SWE. It is linear with the size *b* of the input binary sequence, with $\theta(4b + (m-1)Mb)$.

### C. COMPARISON WITH STATE-OF-THE-ART METHODS

In this section, DSWE is compared to state-of-the-art methods that take into account one to three of the following biological constraints (see Section I-A): maximal homopolymer length, controlled G-C content and prohibited motifs. Table 5 shows the performances of such methods, providing the information rate they achieve depending on their parameterization (e.g., when it is possible, the maximal homopolymer size *N*, a balanced G-C content, prohibited motifs). In what follows, we discuss these results by method class, according to the number of constraints they take into account.
<table><caption>TABLE 5. Comparison of encoding methods from the state-of-the-art and the proposed DSWE scheme. Information rates are given in bits per base (BPB), depending on the maximal homopolymer length *N*. 'N' means Non Applicable, the method does not consider this constraint so no results can be given.</caption><thead><tr><th>Class</th><th>Method</th><th>Rate without HP</th><th>Rate N = 3 (BPB)</th><th>Rate N = 4 (BPB)</th><th>Rate N = 5 (BPB)</th><th>Prohibited motifs</th><th>Controlled G-C content</th><th>Minimal DNA codeword length</th></tr></thead><tbody><tr><td rowspan="3">Methods with one biological constraint</td><td>Cai [13]</td><td>Codeword length dependent</td><td>-</td><td>-</td><td>-</td><td>no</td><td>yes</td><td>variable</td></tr><tr><td>Goldman [12]</td><td>1.58</td><td>-</td><td>-</td><td>-</td><td>no</td><td>no</td><td>variable</td></tr><tr><td>Pic [14]</td><td>1.58</td><td>1.839</td><td>1.877</td><td>1.900</td><td>no</td><td>no</td><td>N</td></tr><tr><td rowspan="11">Methods with two biological constraints</td><td>Church [16]</td><td>-</td><td>1</td><td>-</td><td>-</td><td>no</td><td>yes</td><td>2</td></tr><tr><td>Yazdi [33]</td><td>Codeword length dependent</td><td>-</td><td>-</td><td>-</td><td>yes</td><td>yes</td><td>2</td></tr><tr><td>Song [17]</td><td>-</td><td>1.9</td><td>-</td><td>-</td><td>no</td><td>yes</td><td>10</td></tr><tr><td>Wang [18]</td><td>-</td><td>1.917</td><td>-</td><td>-</td><td>no</td><td>yes</td><td>12</td></tr><tr><td>Grass [19]</td><td>-</td><td>1.77</td><td>-</td><td>-</td><td>no</td><td>yes</td><td>9</td></tr><tr><td>Li [21]</td><td>1</td><td>-</td><td>-</td><td>-</td><td>no</td><td>yes</td><td>variable</td></tr><tr><td>Zan [30]</td><td>1</td><td>1</td><td>1</td><td>1</td><td>no</td><td>yes</td><td>2</td></tr><tr><td>Zhao [25]</td><td>-</td><td>1</td><td>1,92</td><td>-</td><td>no</td><td>yes</td><td>6</td></tr><tr><td>Erlich [26]</td><td>1.65-1.75</td><td>1.65-1.75</td><td>1.65-1.75</td><td>1.65-1.75</td><td>no</td><td>yes</td><td>3</td></tr><tr><td>Nguyen [27]</td><td>1.84</td><td>1.92</td><td>1.92</td><td>1.92</td><td>no</td><td>yes</td><td>200</td></tr><tr><td>Press [29]</td><td>variable</td><td>variable</td><td>variable</td><td>variable</td><td>no</td><td>yes</td><td>100</td></tr><tr><td rowspan="3">Methods with homopolymer, G-C content and prohibited motifs constraints</td><td>Rasool [32]</td><td>-</td><td>1.77</td><td>-</td><td>-</td><td>yes</td><td>no</td><td>3</td></tr><tr><td>Wei [34]</td><td>1</td><td>-</td><td>-</td><td>-</td><td>yes</td><td>yes</td><td>20</td></tr><tr><td>mCGR [31]</td><td>1.8</td><td>1.8</td><td>1.9</td><td>1.9</td><td>yes</td><td>yes</td><td>10</td></tr><tr><td colspan="2">DSWE</td><td>1.33</td><td>1.883</td><td>1.92</td><td>1.94</td><td>yes</td><td>yes</td><td>N-1</td></tr></tbody></table>

## 1) COMPARISON TO METHODS SATISFYING 1 TO 2 BIOLOGICAL CONSTRAINTS

As already discussed above (see Section I-A), the methods from [12] and [14] encode binary data into DNA sequences by combining a binary-to-ternary encoding with the Goldman encoding (see Table 1) with a homopolymer maximal size *N*. [12] has been designed for *N* = 2, i.e. no homopolymers are tolerated. It demonstrates, in the case of uniformly distributed data to encode, an information rate of 1.58 BPB (see Table 5) compared to 1.33 BPB for DSWE(2, 0, 0), i.e. no prohibited motifs are considered (*M* = 0). [14] is a generalization of [12] to longer values of *N*. It relies on the Shannon-Fano compression algorithm. Its performance, provided by its authors, depends on the source of data to encode. For instance, the following experiment is conducted. First, the well-known Kodak image dataset is taken as input. From these images, AC coefficients are obtained with the Discrete Cosine Transform of 8 × 8 pixel blocks. Then, the encoding is applied to a source that follows a frequency table of such AC coefficients. With these parameters, [14] achieves better data density than the Goldman encoding [12]. Indeed, the expected length for a DNA codeword encoding an AC coefficient is of 1.43 nucleotides per symbol of the source for the method from [14] with a maximal homopolymer length of *N* = 3, compared to an average of 1.64 for Goldman [12] with *N* = 1.

Anyway, these methods use data compression algorithms to encode binary data into ternary symbols, DSWE encodes

binary data into DNA codewords. More clearly, DSWE does not use data compression. We will further see in Section III-D, that combined with data compression DSWE is somewhat equivalent or better.

The method from [13] only takes into account the G-C content constraint and provides an information rate that is highly dependent on the size of DNA codewords. It starts to work well for very large codeword sizes giving information rates of about: 1.51 BPB for sequences of 50 bases, 1.75 BPB for 100 bases and 1.87 BPB for 200 bases. DSWE provides similar performances whatever the size of DNA codewords while considering more constraints.

As seen in Table 5, some of the methods that take into account the G-C content and homopolymer constraints, i.e. [16], [17], [18], [19], and [21], only work with single maximal homopolymer length value. They have not been generalized. Two methods achieve a slightly better information rate than DSWE for *N* = 3 and a G-C content of 40-60 %, with 1.9 BPB for [17] and 1.917 BPB for [18]. DSWE(3,0,0) provides 1.88 BPB and a controlled G-C content but is easy to adapt to different values of *N* making it compliant to different types and generation of sequencing technologies, for which the maximal homopolymer length required to recover data differs [10]. Other methods have to be generalized.

Let us compare our method to encoding solutions considering a variable maximal homopolymer size and a controlled G-C content. First, the method from [30] relies on the encoding of one bit into a DNA base regardless of maximum
homopolymer size, so the information rate of this method is always of 1 BPB. On the other side, our method always demonstrates an information rate superior to 1.33 BPB. Although the method in [26] presents a good experimental information rate in between 1.65 and 1.75 BPB [31], it is of quite high complexity as it is statistical and, as reported by its authors, there exist some constraints on the error-correction code to verify (minimal redundancy) to correctly recover data at the decoding stage. The theoretical maximal information rate of this solution is 1.98 BPB. In practice, not all data can be decoded using this method. Thus, additional packages are used to encode data, leading to an information rate of 1.65-1.75 BPB. Reference [27] offers a good information rate with long codewords. For example with homopolymers limited to 3 bases and a 40-60% G-C content, codewords of 200 bases lead to a 1.92 BPB rate. This method presents a small improvement compared to our information rate of 1.88 BPB, at the cost of an impractical fixed codeword size of 200 bases. Indeed, synthesis technologies are still in development and thus can only create small DNA sequences [43], in particular, enzymatic DNA synthesis is limited to less than a hundred bases to ensure high fidelity [44]. This method demonstrates good performances for long DNA codewords, but the information rate decreases with their length. For example, for codewords of 100 bases, the information rate drops to 1.82 BPB for $N = 3$ and a G-C content of 40-60%. Furthermore, as this method uses a dictionary of fixed-size codewords, it is difficult to consider prohibited motifs without a significant information rate drop. The information rate of [29] is determined *a priori*, for example, the typical “half-rate” presented in the article encodes one base from each data bit, leading to an information rate of 1 BPB. The inner code merges an error-correcting code and the encoding of bits into DNA bases, it is thus impossible to obtain an information rate without including error-correction capability. Due to the encoding structure, the algorithm is not suitable for DNA sequences of less than a few hundred bases [21], compared to our method which can consider any size and number of DNA sequences. Additionally, this method demonstrates a decoding complexity that grows exponentially with the input size.

To sum up, although some of the previous methods demonstrate a slightly better information rate for $N \le 4$, none of them consider prohibited motifs.

It is important to note that the proposed approach, while innovative, is susceptible to several potential threats.

First, data security and privacy is at risk. Encryption with AES-256, as presented in Section II-A2, guarantees data confidentiality even in cases of unauthorized access, leakage or theft of DNA sequences. However, the decryption key must be securely stored, so that an attacker cannot recover data from encrypted DNA sequences.

Secondly, data integrity is also at risk. Indeed, DNA molecules can mutate or be degraded, leading to errors in the sequences. Additionally, the biological processes of DNA synthesis and sequencing add errors to DNA sequences.

Thus, DNA sequences have errors. To correct these errors, two strategies can be used. Multiple copies of each DNA sequence can be stored, so that error correction is done by majority voting. This is the solution we used, as presented in Section II-B. Another solution consists in adding an error correction module. Our method, as well as several others, contains no error-correction, it is however possible to add this module before encoding.

Finally, a third concern relies on performances. In Table 5, we present information rate results based on the encoding solutions alone. In reality, DNA sequences are indexed and primers frame them, adding redundant information.

Thus, real information rates are lower than the numbers given. However, in this article, we present information rates based on encoding only. Primers are generally of size 18 to 30 DNA bases, and the index sizes depend on the number of DNA sequences synthesized. Thus, considering information rate based on only information bits allows a fair comparison between different encoding methods. A second parameter is important to consider regarding performances. Our method relies on dynamic encodings, which creates computational overhead. DNA sequences encoded with our method can be of varied lengths, thus the size of each DNA sequence must be stored along with the primers framing each sequence. As primers and indexing methods are already stored, adding the size of each sequence is not extremely costly.

## 2) COMPARISON TO mCGR [31]

Before comparing the performances of our solution to the only other method that can consider any prohibited motifs as well as homopolymers and G-C content constraints, let us give experimental results for the methods that consider some specific motifs.

In [32], the encoding method avoids the appearance of homopolymers longer than 2 bases and of 5 specific 3-bases motifs, using two encoding dictionaries. This method [32] is tested on medical images as well as mp3, mp4 and pdf files, demonstration an average information rate of 1.77 BPB. Thus, this method demonstrates good performances, but can only take into account one homopolymer size and a few prohibited motifs. Furthermore, it is not tailored to consider more, or other sizes of prohibited motifs.

In [34], the method considers the following constraints: no homopolymers, a balanced G-C content, and no appearance of 20-bases primers from a dictionary in encoded DNA sequences. Their goal is to limit collisions between 20-bases primers and data-encoding DNA sequences. The method relies on the encoding of binary triplets into DNA triplets according to a mapping table, leading to an information rate of 1 bit per base (BPB), whatever the number of primers (limited to an upper bound that depends on several parameters, as calculated in the paper [34]). In comparison, our encoding method has an information rate of 1.33 BPB for $N = 1$ when no motifs are considered, and the information rate decreases slowly when more primers are forbidden. Moreover, our scheme can consider prohibited motifs of any size.
Herein, we compare the performance of our solution to the only other method mCGR [31] considering homopolymers, G-C content as well as prohibited motifs. As described in Section I-A, the strategy adopted in mCGR consists of building a dictionary following a “fractal” strategy to go across the base-4 codeword space. They then retain DNA codewords that satisfy the homopolymer and balance G-C content constraints, also testing if a selected codeword is not a prohibited motif. They then post-process this dictionary eliminating all DNA codewords beginning and ending with at least half of a prohibited motif. The following comparison assessment is expressed in terms of experimental information rate, run time, and data recovery performance using the DNA storage chain simulator of [36].

### a: EXPERIMENTAL INFORMATION RATE

Let us first compare the information rate of the two solutions depending on the maximal homopolymer length *N*. For this purpose, we encoded the image “Lena” of size 256 × 256.

The experimental information rates of mCGR [31] and DSWE are given in Table 6, depending on the number *M* of prohibited motifs of size *m* = 6 and maximal homopolymer size *N*. The rate $R_{\text{DSWE(N,M,6)}}^{E}$ is given in average. Let us first evaluate the influence of the maximal homopolymer length *N* for a fixed number of motifs *M* on the information rate of DSWE and mCGR. To do so, we fixed the number of prohibited motifs to *M* = 40 and *N* ∈ {2, 3, 4, 5}. As given in Table 6, DSWE reaches an information rate of 1.20 BPB, 1.77 BPB, 1.80 BPB and 1.86 BPB for *N* = 2, 3, 4 and 5, respectively, mCGR achieves 1.6 BPB for *N* = 2 and 1.7 BPB for *N* = 3, 4 and 5. Even though mCGR is better in the case *N* = 2, DSWE is more interesting for larger values of *N*; values that are more likely to happen in practice in terms of maximum homopolymer size. Our gain of performance mainly stands on the dictionary cleaning procedure of mCGR that deletes a large number of DNA codewords for a given prohibited motif. Moreover, the rate of DSWE tends to the ideal rate of 2 BPB with the increase of *N* mCGR’s rate $R_{\text{mCGR}}^{E}$ peaks at 1.9 BPB. Indeed, as *N* grows so does the proportion of classically encoded bits (2 bits into one base). Note also that our solution is more flexible and can take into account any value higher than 1 for *N*, mCGR cannot consider values of *N* higher than the length *l* of its DNA codewords.

The second experiment we conducted focuses on the impact of the number of prohibited motifs *M* on the information rate of DSWE and mCGR. To this end, the maximal homopolymer length *N* was fixed to 3 and the size of prohibited motifs to *m* = 6, while considering *M* ∈ {10, 20, 30, 40, 50, 60, 70, 76}. At this time, two sizes of DNA codewords *l* = 6 and *l* = 10 were considered for mCGR, leading thus to the generation of two distinct dictionaries. The reason is that a codeword length of 6 bases corresponds to the chosen size of prohibited motifs, and thus allows us to make a fair comparison of mCGR with DSWE based on a sliding window of 6 bases. The dictionary with

<table><caption>TABLE 6. Experimental information rates $R_{\text{DSWE(N,M,6)}}^{E}$ of DSWE and $R_{\text{mCGR}}^{E}$ of mCGR depending on the maximal homopolymer size *N* and number *M* of prohibited motifs of size *m* = 6. The experimental rate $R_{\text{DSWE(N,M,6)}}^{E}$ is given in average with each associated standard deviation. The experimental rate $R_{\text{mCGR}}^{E}$ for mCGR is given for DNA codewords of length *l* = 10 bases.</caption><thead><tr><th>M</th><th>N</th><th>R<sup>E</sup><sub>DSWE(N,M,6)</sub> (in BPB)</th><th>Standard deviation of R<sup>E</sup><sub>DSWE(N,M,6)</sub> (in BPB)</th><th>R<sup>E</sup><sub>mCGR</sub> (in BPB) for l = 10</th></tr></thead><tbody><tr><td rowspan="4">0</td><td>2</td><td>1.334</td><td>0.015</td><td><strong>1.8</strong></td></tr><tr><td>3</td><td><strong>1.882</strong></td><td>0.010</td><td>1.8</td></tr><tr><td>4</td><td><strong>1.921</strong></td><td>0.008</td><td>1.9</td></tr><tr><td>5</td><td><strong>1.939</strong></td><td>0.005</td><td>1.9</td></tr><tr><td rowspan="4">20</td><td>2</td><td>1.302</td><td>0.017</td><td><strong>1.7</strong></td></tr><tr><td>3</td><td><strong>1.839</strong></td><td>0.011</td><td>1.8</td></tr><tr><td>4</td><td><strong>1.880</strong></td><td>0.01</td><td>1.8</td></tr><tr><td>5</td><td><strong>1.902</strong></td><td>0.006</td><td>1.8</td></tr><tr><td rowspan="4">40</td><td>2</td><td>1.239</td><td>0.019</td><td><strong>1.6</strong></td></tr><tr><td>3</td><td><strong>1.803</strong></td><td>0.011</td><td>1.7</td></tr><tr><td>4</td><td><strong>1.843</strong></td><td>0.011</td><td>1.7</td></tr><tr><td>5</td><td><strong>1.864</strong></td><td>0.007</td><td>1.7</td></tr><tr><td rowspan="4">76</td><td>2</td><td>1.167</td><td>0.020</td><td><strong>1.2</strong></td></tr><tr><td>3</td><td><strong>1.730</strong></td><td>0.013</td><td>1.3</td></tr><tr><td>4</td><td><strong>1.768</strong></td><td>0.011</td><td>1.3</td></tr><tr><td>5</td><td><strong>1.787</strong></td><td>0.009</td><td>1.4</td></tr></tbody></table>

codewords of 10 bases is considered to compare DSWE to the optimized version of mCGR. Experimental information rates for mCGR and DSWE depending on the number *M* of prohibited motifs are given in Fig. 10. As it can be seen, the length of the DNA codewords strongly impacts the information rate of the solution given in [31]. For both codeword sizes, *l* = 6 or *l* = 10, the information rate of this method drops when more than *M* = 30 motifs are considered with a greater decrease for values superior to *M* = 60. That is not the case of DSWE, the information rate decreases linearly (see Table 6) but slowly and outperforms mCGR for large values of *M*. For instance, when *M* = 76, DSWE(3, 76, 6) achieves an experimental information rate of 1.73 BPB, whereas mCGR provides a rate of 0.75 BPB and 1.3 BPB with DNA codewords of size *l* = 6 and *l* = 10, respectively. The fact that mCGR collapses with a large number of prohibited motifs again comes from its dictionary-cleaning procedure. For any prohibited motif, mCGR deletes any codeword from the dictionary beginning or ending with at least half of this motif.

To sum up, DSWE demonstrates a better information rate than mCGR for *N* > 2 for any number *M* of prohibited motifs.

### b: RUNTIME

In this Section, we compare the encoding runtimes of the two solutions, depending on the maximal homopolymer length *N* and the number *M* of prohibited motifs. To compare them, the “Lena” image of size 256 × 256 was encoded 100 times for each set of parameters and each solution. It is important to note that we did not implement an optimized version of our
<figure><img src="image_11.png" /><figcaption>**FIGURE 10.** Experimental information rates $R_{DSWE(3,M,6)}^E$ of DSWE($N = 3, M, m = 6$) and $R_{mCGR}^E$ of mCGR depending on the number $M$ of prohibited motifs, with $N = 3$ and $m = 6$. mCGR was implemented considering two DNA codeword sizes $l = 6$ and $l = 10$.</figcaption></figure>

proposal. The runtimes of our proposal and mCGR are given in average in Table 7 for various values of $N$ and $M$, with $m = 6$, using a laptop (Intel Celeron 3205U, 4GB RAM, 2 cores CPU 1.5 GHz). One can first remark that, for a given value of $M$, the encoding runtime of our proposal decreases with the value of $N$. This is because the greater $N$, the greater the number of times the Classical DNA Encoding is used. It can also easily be seen that the encoding runtime of our procedure increases with the number $M$ of prohibited motifs while the runtime of mCGR is quite constant. Regarding mCGR, even though its runtime increases with $N$, due to the growth of its dictionary, it obtains better performances than DSWE. Such a performance difference mainly results from the DSWE sliding window which does $M$ tests at each position in the DNA sequence (see Sliding Window Encoding Section). This is a limit of our work, as for large datasets and numbers of prohibited motifs, it could lead to a significant runtime increase. On the contrary, mCGR simply uses its dictionary DNA codewords. Let us recall however that our proposal achieves a performance rate much greater than mCGR, about 25% of gain for $M = 76$, and that its implementation can be optimized in terms of several tests, in particular. A possible optimization is the use of prefix trees to test if a window corresponds to the beginning of a prohibited motif. The complexity of our solution grows linearly with the input size for fixed $N, m$, and $M$ parameters. Thus, as our method takes on average 5.0 seconds to encode the image Lena of 65 kb for $N = 4$ and $M = 76$ and demonstrates a linear complexity, we can deduce the runtime of larger datasets. For example, encoding a megabyte ($10^6$ bytes) of data would take roughly 16 minutes with the same parameters.

In conclusion, the encoding runtime of DSWE gets bigger with the increase of considered prohibited motifs and the decrease of the maximal homopolymer length $N$. mCGR achieves better runtime performance compared to our non-optimized implementation but with an information rate much smaller than DSWE for any $N > 2$ and $M$ values (see previous Section). Notice also that, contrarily to mCGR, our

<table><caption>**TABLE 7.** Comparison of encoding runtimes of the test image “Lena” by mCGR and DSWE expressed in seconds depending on the number of prohibited motifs $M$ and the maximal homopolymer size $N$, as well as dictionary generation runtime (in seconds) for mCGR.</caption><thead><tr><th rowspan="2">M</th><th rowspan="2">N</th><th>Encoding with DSWE</th><th colspan="2">Encoding with mCGR</th></tr><tr><th>Encoding runtime of DSWE (in seconds)</th><th>Encoding runtime of mCGR (in seconds)</th><th>Dictionary generation runtime of mCGR (in seconds)</th></tr></thead><tbody><tr><td rowspan="3">0</td><td>2</td><td>1.9</td><td>0.6</td><td>18.5</td></tr><tr><td>3</td><td>1.4</td><td>0.9</td><td>26</td></tr><tr><td>4</td><td>1.3</td><td>1.1</td><td>33</td></tr><tr><td rowspan="3">20</td><td>2</td><td>3.3</td><td>0.4</td><td>15</td></tr><tr><td>3</td><td>2.7</td><td>0.6</td><td>19</td></tr><tr><td>4</td><td>2.6</td><td>0.8</td><td>23</td></tr><tr><td rowspan="3">40</td><td>2</td><td>4.7</td><td>0.3</td><td>14</td></tr><tr><td>3</td><td>3.9</td><td>0.4</td><td>17</td></tr><tr><td>4</td><td>3.6</td><td>0.5</td><td>18</td></tr><tr><td rowspan="3">60</td><td>2</td><td>5.5</td><td>0.2</td><td>13</td></tr><tr><td>3</td><td>4.0</td><td>0.3</td><td>17</td></tr><tr><td>4</td><td>3.9</td><td>0.3</td><td>18</td></tr><tr><td rowspan="3">76</td><td>2</td><td>6.9</td><td>0.2</td><td>13</td></tr><tr><td>3</td><td>4.6</td><td>0.2</td><td>17</td></tr><tr><td>4</td><td>5.0</td><td>0.2</td><td>17</td></tr></tbody></table>

DSWE solution includes an encryption module to guarantee data confidentiality.

### c: DNA SEQUENCE RECOVERY

In this Section, we evaluate the robustness of the above encoding schemes to the common errors that exist in a DNA storage chain (see Section II-A). In particular, we are interested in demonstrating that, despite the dynamic character of our DSWE encoding, this one offers at least the same performance as the scheme from mCGR that generates DNA sequences of fixed length.

For this experiment, biological functionalities of a DNA storage chain are simulated using the simulator proposed in [36] (see Section II-A). The simulator considers the fact that errors are not identically distributed in DNA sequences. Indeed, some patterns are more prone to errors than others, and there is a dependency between successive errors. To obtain an accurate error simulation, the model has been trained on genomic data, as well as experimental data that has been retrieved after storage into DNA. These two types of data introduce on average 3% and 10% of errors respectively. This way, the channel model is based on experimental error probabilities, mainly caused by the MinION nanopore sequencer. The simulator takes as input a DNA sequence $D$ and outputs $X$ possibly erroneous read copies of $D$ into a fastq file. These copies are post-processed with the consensus procedure from [38] into a reconstructed DNA sequence. Notice that, in case too many erroneous copies are provided in the consensus procedure, this one may decide not to provide a DNA sequence as output. Additionally, such a consensus does not guarantee that it provides an error free DNA sequence. It can still contain badly decoded nucleotides.
<table><caption>**TABLE 8.** Comparison of the number *X* of copies required to recover with no errors DNA sequences encoded with mCGR and DSWE after going through the simulator published in [36] and the post-processing consensus from [38], depending on a maximal homopolymer size *N* and a number *M* of 6-nucleotide prohibited motifs. These given values of *X* have been calculated considering 1000 DNA sequences that encode the same information, 1000 or 5000 bits of data.</caption><thead><tr><th rowspan="2">M</th><th rowspan="2">N</th><th colspan="2">DNA sequences encoding 1000 bits</th><th colspan="2">DNA sequences encoding 5000 bits</th></tr><tr><th>DSWE</th><th>mCGR [31]</th><th>DSWE</th><th>mCGR [31]</th></tr></thead><tbody><tr><td rowspan="3">0</td><td>2</td><td>32 reads</td><td>28 reads</td><td>45 reads</td><td>39 reads</td></tr><tr><td>3</td><td>29 reads</td><td>26 reads</td><td>45 reads</td><td>39 reads</td></tr><tr><td>4</td><td>28 reads</td><td>26 reads</td><td>44 reads</td><td>37 reads</td></tr><tr><td rowspan="3">20</td><td>2</td><td>32 reads</td><td>30 reads</td><td>46 reads</td><td>40 reads</td></tr><tr><td>3</td><td>28 reads</td><td>26 reads</td><td>44 reads</td><td>39 reads</td></tr><tr><td>4</td><td>29 reads</td><td>28 reads</td><td>44 reads</td><td>37 reads</td></tr><tr><td rowspan="3">76</td><td>2</td><td>34 reads</td><td>30 reads</td><td>47 reads</td><td>42 reads</td></tr><tr><td>3</td><td>30 reads</td><td>28 reads</td><td>45 reads</td><td>40 reads</td></tr><tr><td>4</td><td>30 reads</td><td>28 reads</td><td>44 reads</td><td>40 reads</td></tr></tbody></table>

The following tests aim at evaluating the influence of the maximum homopolymer size (*N*) and of the number *M* of *m* base long prohibited motifs as well as of the number of sequenced copies *X*, on the capacity of the two encoding schemes to error-free recover data. The encrypted text [36] was first separated into 1000 sequences of 1000 bits that were next encoded into DNA sequences with mCGR and DSWE such that: *N* ∈ {2, 3, 4}, *M* ∈ {0, 20, 76}, *m* = 6. mCGR was also parameterized to ensure a G-C content of 40–60% with DNA codewords of length of *l* = 10 bases. We give in Table 8 the impact of *N* and *M* on the number of copies *X* required to obtain 100% of correctly recovered DNA sequences.

As seen, whatever the values of *M* and *N* ≤ 4, both methods successfully recover encoded DNA sequences with quite the same number of copies. Moreover, to do so, less than *X* = 35 ~ 40 copies are enough.

To go further, we evaluate the impact of our dynamic encoding for the recovery of long DNA sequences. In the following tests, we compare the number *X* of copies necessary to retrieve DNA sequences encoding 5000 bits of data, using our DSWE and the concurrent method mCGR [31]. As can be seen in Table 8, DNA sequences encoded by both methods can be recovered with a similar number *X* of copies, with *X* ∈ [40, 50]. DNA sequences encoded with mCGR require a few less copies, as some error propagation must be present in the sequences encoded with our dynamic encoding method DSWE. Thus, our solution is preferably used in scenarios with low error rates to limit the impact of error propagation.

To conclude, DNA sequences encoding up to 5000 bits using both methods can be recovered with less than 50 copies. This number is quite small considering that amplifying DNA sequences with a PCR gives access to many more copies. As a consequence, one can consider that the dynamic property of our encoding scheme does not significantly impact the recovery of DNA sequences. At the same time, DSWE guarantees a much better information rate (see Fig. 10).

## D. DSWE ENCODING OF COMPRESSED DATA

To optimize the density of data stored in DNA molecules, DSWE can be preceded by a compression step. Indeed, considering the price of DNA synthesis, an information rate gain can greatly reduce data storage costs. In this section, we thus replaced the encryption process in Fig. 1 with a compression step before DSWE encoding data, and compare this solution in terms of performance to the method [22] and [35].

We evaluate these methods in terms of compression ratio. Considering an uncompressed binary bit-stream *S* as input, an output DNA encoded sequence *D*, *r* is expressed in bits of data per base (BPB) such that:

$$r = \frac{|S|}{|D|} \text{ BPB} \qquad (9)$$

As stated in Section I-A, [22] first builds a Huffman tree to binary-to-ternary encode data. It then applies the Goldman encoding to convert ternary data into DNA nucleotides without homopolymers. To compare with this method, we compress data with the Huffman encoding and then apply our DSWE encoding. For the sake of simplicity, both methods have been implemented using minimum-variance Huffman trees encoding 8-bit symbols. DSWE has been parameterized to avoid homopolymers, i.e. *N* = 1.

As an experimental dataset, as in [22], we use the well-known test images Lena (512 × 512 pixels, 8 bits/pixel) and Jet (256 × 256 pixels, 8 bits/pixel) and the text “Where the mind is without fear” [45] of 490 ASCII characters. Results are given in Table 9. In the text, our solution shows an improvement of 0.69 BPB but provides lower compression ratios for the two images, of 0.16 BPB and 0.17 BPB. However, Huffman code is not often used for image compression. Moreover, it is important to recall that DSWE performance remains limited for values of *N* smaller than 3 (the current synthesis and sequencing constraints [10]). If we simply change the maximal homopolymer length *N* to 3, we achieve compression ratios of 2.305 BPB for Jet and 2.017 BPB for Lena.

On its side, JPEG-DNA [35] is a modified version of the image compression standard JPEG. It also includes Huffman and Goldman encodings. To compare ourselves to JPEG-DNA, we first classically compress an image using JPEG before encoding the compressed bitstream with DSWE parameterized for *N* = 3. For a fair comparison, the compression ratio for JPEG-DNA is calculated using only the binary stream of the image. The following results are given for the same image data set and image quality levels as in [35]. Image quality is evaluated using the PSNR (Peak Signal to Noise Ratio) measure; the standard JPEG quality metrics. As seen in Table 10, our solution demonstrates better results in terms of compression ratio for all 7 images for a PSNR corresponding to a 50% image quality.

These results show that our DSWE encoding solution can easily be associated with compression algorithms and can lead to significant data density gains compared to solutions
<table><caption>TABLE 9. Comparison of compression ratios in BPB (bits per base) of the encoding scheme from [22] and DSWE preceded by Huffman compression.</caption><thead><tr><td>Data</td><td>Ratio of [22]</td><td>Ratio of DSWE</td></tr></thead><tbody><tr><td>Text [45]</td><td>1.86</td><td><b>2.55</b></td></tr><tr><td>Lena</td><td><b>1.59</b></td><td>1.43</td></tr><tr><td>Jet</td><td><b>1.81</b></td><td>1.63</td></tr></tbody></table>

<table><caption>TABLE 10. Comparison of compression ratios in BPB (bits per base) of JPEG-DNA [35] and DSWE preceded by JPEG compression. For each image, compression ratios are compared for the same PSNR, equivalent to a 50% quality level.</caption><thead><tr><th rowspan="2">Image</th><th rowspan="2">PSNR (dB)</th><th colspan="2">Compression ratio (in BPB)</th></tr><tr><th>JPEG-DNA</th><th>DSWE</th></tr></thead><tbody><tr><td>baboon (grayscale)</td><td>28.2</td><td>8.19</td><td><b>10.81</b></td></tr><tr><td>gray21</td><td>48.0</td><td>78.83</td><td><b>91.40</b></td></tr><tr><td>jet</td><td>36.1</td><td>17.22</td><td><b>22.38</b></td></tr><tr><td>lena</td><td>35.8</td><td>18.47</td><td><b>23.79</b></td></tr><tr><td>baboon (color)</td><td>28.6</td><td>18.64</td><td><b>29.47</b></td></tr><tr><td>Kodim 23</td><td>38.5</td><td>49.00</td><td><b>81.33</b></td></tr><tr><td>pepper</td><td>34.3</td><td>43.67</td><td><b>57.44</b></td></tr></tbody></table>

that combine compression based binary-to-ternary and Goldman encodings. Moreover, we verified that DSWE applied on compressed data also ensures a balanced G-C content. This is because compression maximizes data entropy, as does encryption, which provides an independent and identically distributed binary stream.

## IV. DISCUSSION

In this paper, we presented a novel Dynamic Sliding Window Encoding scheme that encode AES-encrypted binary data into variable length DNA sequences. Parameterized such as DSWE(N, M, m), it allows satisfying three main constraints: a maximum homopolymer size of N; a balanced G-C content close to 50%; and, avoiding the occurrence of M prohibited motifs of m nucleotides. It first relies on four dictionaries selected for data encoding depending on the last encoded base with as objective to avoid the generation of homopolymers of size N + 1. Each of these dictionaries associates fixed-length binary blocks to variable length DNA codewords. In second, it takes advantage of a sliding window of size m − 1 bases that are exploited to detect the beginning of prohibited motifs used for data indexing or as a primer and to avoid them by adding a non-coding base when necessary. As demonstrated, our proposal also preserves the uniform distribution of AES-encrypted input data leading to DNA sequences with a balanced G-C content.

Our method is flexible and can be easily adapted to any value of N, contrarily to the only concurrent method mCGR [31], the dictionary computation procedure of which has a complexity that increases along with N and M. Beyond, our DSWE allows us to reach a better information rate than mCGR for N ≥ 3, whatever the number M of prohibited motifs. Moreover, for a fixed value of M, the information rate of DSWE tends towards the ideal 2 BPB rate as the maximum homopolymer size N grows. Additionally, for a

fixed N, the information rate decreases slowly in a linear manner according to M. More clearly, in this work, up to 76 prohibited motifs of 6 bases were considered, leading to an information rate decrease of 0.15 BPB in average. Our method can thus consider a greater number of motifs with a small information rate decrease. That is not the case of mCGR, the information rate of which drops rapidly when many prohibited motifs are considered. Additionally, the method from [31] is limited to prohibited motifs lengths equal to the DNA codeword length, i.e. up to 12 bases, ours has no upper bound.

As a note, our code is not optimized and could be much faster, for example by using an optimized string-matching algorithm for the sliding window. However, the encoding/decoding runtime grows with the number of prohibited motifs because the number of comparisons to the sliding window grows. That is not the case of mCGR which is faster as its encoding/decoding runtimes are constant being based on the dictionary size. Anyway, as shown in the performance comparison Section III-C, our approach can be effectively used in real practice. One way to break this limitation is to consider primers of long prohibited motifs that are a combination of smaller ones. For instance, one can build primers of 18 and 24 bases that are the concatenation of 6-base prohibited motifs. Additionally, our solution can be generalized to consider prohibited motifs of distinct sizes, each with a tailored sliding window, at the price however of a complexity increase.

Our encoding method is independent of the chosen encryption algorithm as long as this latter outputs uniformly distributed data to guarantee a balanced G-C content in the resulting DNA sequences. This is a property that perfect cryptosystems have. Such a possibility to interchange the cryptosystem in our system is herein of great interest as in some decades AES may no longer be secure. With time, AES can simply be replaced by a more efficient cryptosystem without changing the basic principles of our Dynamic Sliding Windows Encoding scheme.

We have also shown that DSWE applied to compressed data provides equivalent or better performances than solutions that have considered compression and DNA encoding jointly (see Section III-D).

In this work, we did not consider DSWE with error correction codes, as some concurrent methods. Indeed, error correction for dynamic DNA encodings; that is to say for methods that are based on variable-length codewords (see Section I-A); is still an open question. But, as demonstrated in Section III-C2, our solution requires a small number of copies of a DNA sequence to read it without errors, like other proposals. This number is negligible compared to the exponential amplification power of PCR, which can be used before sequencing.

## V. CONCLUSION

In this paper, a new encoding method of encrypted data stored in a DNA form has been proposed. It takes into account some
biological constraints, i.e. G-C content and homopolymers, and prohibited motifs of 6 nucleotides used for data indexing. This solution relies on a novel dynamic sliding window encoding DSWE that allows: i) to avoid homopolymers longer than *N* bases by encoding fixed-size binary data into variable length DNA codewords, and ii) to prevent the appearance of the prohibited motifs during DNA-sequence encoding using a sliding window. Compared to state-of-the-art schemes, our method reaches better information rates for different maximal homopolymer lengths *N* and any number of prohibited motifs, while ensuring a balanced G-C content. We have also shown that DSWE applied on compressed data provides good performances compared to the state of art methods. Furthermore, using a recent DNA storage chain simulator, we show that data recovery is not impacted by our proposed DSWE. Future works will focus on other biological constraints, as well as reducing the algorithm complexity. Indeed, our solution could be optimized to obtain a logarithmic complexity instead of a linear complexity, i.e in $Θ(t)$. Another avenue for future works concerns real-world synthesis validation of our encoding solution, by synthesizing DSWE-encoded sequences and recovering encoded data from DNA molecules.

## REFERENCES

[1] P. Taylor. *Amount of Data Created, Consumed, and Stored 2010-2020, With Forecasts To 2025*. Accessed: Oct. 24, 2023. [Online]. Available: https://www.statista.com/statistics/871513/worldwide-data-created/

[2] S. Wang, X. Mao, F. Wang, X. Zuo, and C. Fan, "Data storage using DNA," *Adv. Mater.*, vol. 36, no. 6, Oct. 2023, Art. no. 2307499.

[3] A. Doricchi, C. M. Platnich, A. Gimpel, F. Horn, M. Earle, G. Lanzavecchia, A. L. Cortajarena, L. M. Liz-Marzán, N. Liu, R. Heckel, R. N. Grass, R. Krahne, U. F. Keyser, and D. Garoli, "Emerging approaches to DNA data storage: Challenges and prospects," *ACS Nano*, vol. 16, no. 11, pp. 17552-17571, Nov. 2022.

[4] S. Zhang, R. Fan, Y. Liu, S. Chen, Q. Liu, and W. Zeng, "Applications of transformer-based language models in bioinformatics: A survey," *Bioinf. Adv.*, vol. 3, no. 1, Jan. 2023, Art. no. vbad001.

[5] S. L. Lovelock, R. Crawshaw, S. Basler, C. Levy, D. Baker, D. Hilvert, and A. P. Green, "The road to fully programmable protein catalysis," *Nature*, vol. 606, no. 7912, pp. 49-58, Jun. 2022.

[6] H. Ledford and E. Callaway, "Pioneers of revolutionary CRISPR gene editing win chemistry Nobel," *Nature*, vol. 586, no. 7829, pp. 346-347, Oct. 2020.

[7] A. David, S. Islam, E. Tankhilevich, and M. J. Sternberg, "The AlphaFold database of protein structures: A biologist's guide," *J. Mol. Biol.*, vol. 434, no. 2, Jan. 2022, Art. no. 167336.

[8] P. Ney, K. Koscher, L. Organick, L. Ceze, and T. Kohno, "Computer security, privacy, and DNA sequencing: Compromising computers with synthesized DNA, privacy leaks, and more," in *Proc. 26th USENIX Secur. Symp. (USENIX Secur.)*, Aug. 2017, pp. 765-779.

[9] S. Faezi, S. R. Chhetri, A. Vaibhav Malawade, J. C. Chaput, W. Grover, P. Brisk, and M. A. Al Faruque, "Acoustic side channel attack against DNA synthesis machines: Poster abstract," in *Proc. ACM/IEEE 11th Int. Conf. Cyber-Phys. Syst. (ICCPS)*, Apr. 2020, pp. 186-187.

[10] M. G. Ross, C. Russ, M. Costello, A. Hollinger, N. J. Lennon, R. Hegarty, C. Nusbaum, and D. B. Jaffe, "Characterizing and measuring bias in sequence data," *Genome Biol.*, vol. 14, no. 5, pp. 1-20, May 2013.

[11] K. Kadri, "Polymerase chain reaction (PCR): Principle and applications," in *Synthetic Biology-New Interdisciplinary Science*. London, U.K.: IntechOpen, 2019, pp. 1-17.

[12] N. Goldman, P. Bertone, S. Chen, C. Dessimoz, E. M. LeProust, B. Sipos, and E. Birney, "Towards practical, high-capacity, low-maintenance information storage in synthesized DNA," *Nature*, vol. 494, no. 7435, pp. 77-80, Feb. 2013.

[13] K. Cai, H. M. Kiah, M. Motani, and T. T. Nguyen, "Coding for segmented edits with local weight constraints," in *Proc. IEEE Int. Symp. Inf. Theory (ISIT)*, Jul. 2021, pp. 1694-1699.

[14] X. Pic and M. Antonini, "A constrained Shannon-fano entropy coder for image storage in synthetic DNA," in *Proc. 30th Eur. Signal Process. Conf. (EUSIPCO)*, Aug. 2022, pp. 1367-1371.

[15] K. Bibak, B. M. Kapron, and V. Srinivasan, "Unweighted linear congruences with distinct coordinates and the Varshamov-Tenengolts codes," *Des., Codes Cryptogr.*, vol. 86, no. 9, pp. 1893-1904, Sep. 2018.

[16] G. M. Church, Y. Gao, and S. Kosuri, "Next-generation digital information storage in DNA," *Science*, vol. 337, no. 6102, p. 1628, Sep. 2012.

[17] W. Song, K. Cai, M. Zhang, and C. Yuen, "Codes with run-length and GC-content constraints for DNA-based data storage," *IEEE Commun. Lett.*, vol. 22, no. 10, pp. 2004-2007, Oct. 2018.

[18] Y. Wang, M. Noor-A-Rahim, E. Gunawan, Y. L. Guan, and C. L. Poh, "Construction of bio-constrained code for DNA data storage," *IEEE Commun. Lett.*, vol. 23, no. 6, pp. 963-966, Jun. 2019.

[19] R. N. Grass, R. Heckel, C. Dessimoz, and W. J. Stark, "Genomic encryption of digital data stored in synthetic DNA," *Angew. Chem.*, vol. 132, no. 22, pp. 8554-8558, May 2020.

[20] L. Li, S. Zhu, and L. Liu, "Three new classes of entanglement-assisted quantum MDS codes from generalized Reed-Solomon codes," *Quantum Inf. Process.*, vol. 18, no. 12, pp. 1-16, Dec. 2019.

[21] X. Li, M. Chen, and H. Wu, "Multiple errors correction for position-limited DNA sequences with GC balance and no homopolymer for DNA-based data storage," *Briefings Bioinf.*, vol. 24, no. 1, Jan. 2023, Art. no. bbac484.

[22] P. Mishra, C. Bhaya, A. K. Pal, and A. K. Singh, "Compressed DNA coding using minimum variance Huffman tree," *IEEE Commun. Lett.*, vol. 24, no. 8, pp. 1602-1606, Aug. 2020.

[23] M. Dimopoulou, M. Antonini, P. Barbry, and R. Appuswamy, "A biologically constrained encoding solution for long-term storage of images onto synthetic DNA," in *Proc. 27th Eur. Signal Process. Conf. (EUSIPCO)*, Sep. 2019, pp. 1-5.

[24] K. G. Benerjee and A. Banerjee, "On DNA codes with multiple constraints," *IEEE Commun. Lett.*, vol. 25, no. 2, pp. 365-368, Feb. 2021.

[25] Y. Zhao, B. Cao, P. Wang, K. Wang, and B. Wang, "DBTRG: De Bruijn trim rotation graph encoding for reliable DNA storage," *Comput. Struct. Biotechnol. J.*, vol. 21, pp. 4469-4477, Jan. 2023.

[26] Y. Erlich and D. Zielinski, "DNA fountain enables a robust and efficient storage architecture," *Science*, vol. 355, no. 6328, pp. 950-954, Mar. 2017.

[27] T. T. Nguyen, K. Cai, K. A. Schouhamer Immink, and H. M. Kiah, "Capacity-approaching constrained codes with error correction for DNA-based data storage," *IEEE Trans. Inf. Theory*, vol. 67, no. 8, pp. 5602-5613, Aug. 2021.

[28] Z. Ping, S. Chen, G. Zhou, X. Huang, S. J. Zhu, H. Zhang, H. H. Lee, Z. Lan, J. Cui, T. Chen, W. Zhang, H. Yang, X. Xu, G. M. Church, and Y. Shen, "Towards practical and robust DNA-based data archiving using the yin-yang codec system," *Nature Comput. Sci.*, vol. 2, no. 4, pp. 234-242, Apr. 2022.

[29] W. H. Press, J. A. Hawkins, S. K. Jones, J. M. Schaub, and I. J. Finkelstein, "HEDGES error-correcting code for DNA storage corrects indels and allows sequence constraints," *Proc. Nat. Acad. Sci. USA*, vol. 117, no. 31, pp. 18489-18496, Aug. 2020.

[30] X. Zan, R. Xie, X. Yao, P. Xu, and W. Liu, "A robust and efficient DNA storage architecture based on modulation encoding and decoding," *J. Chem. Inf. Model.*, vol. 63, no. 12, pp. 3967-3976, Jun. 2023.

[31] H. F. Löchel, M. Welzel, G. Hattab, A.-C. Hauschild, and D. Heider, "Fractal construction of constrained code words for DNA storage systems," *Nucleic Acids Res.*, vol. 50, no. 5, p. e30, Mar. 2022.

[32] A. Rasool, J. Hong, Q. Jiang, H. Chen, and Q. Qu, "BO-DNA: Biologically optimized encoding model for a highly-reliable DNA data storage," *Comput. Biol. Med.*, vol. 165, Oct. 2023, Art. no. 107404.

[33] S. M. H. Tabatabaei Yazdi, H. M. Kiah, R. Gabrys, and O. Milenkovic, "Mutually uncorrelated primers for DNA-based data storage," *IEEE Trans. Inf. Theory*, vol. 64, no. 9, pp. 6283-6296, Sep. 2018.

[34] Y. Wei, B. Li, and D. H. C. Du, "An encoding scheme to enlarge practical DNA storage capacity by reducing primer-payload collisions," in *Proc. 29th ACM Int. Conf. Architectural Support Program. Lang. Operating Syst.*, vol. 2, Apr. 2024, pp. 71-84.

[35] M. Dimopoulou, E. G. S. Antonio, and M. Antonini, "A JPEG-based image coding solution for data storage on DNA," in *Proc. 29th Eur. Signal Process. Conf. (EUSIPCO)*, Aug. 2021, pp. 786-790.
[36] B. Hamoum, E. Dupraz, L. Conde-Canencia, and D. Lavenier, “Channel model with memory for DNA data storage with nanopore sequencing,” in *Proc. 11th Int. Symp. Topics Coding (ISTC)*, Aug. 2021, pp. 1–5.

[37] M. Jain, H. E. Olsen, B. Paten, and M. Akeson, “The Oxford nanopore MinION: Delivery of nanopore sequencing to the genomics community,” *Genome Biol.*, vol. 17, no. 1, pp. 1–11, Dec. 2016.

[38] D. Lavenier, “Constrained consensus sequence algorithm for DNA archiving,” 2021, arXiv:2105.04993.

[39] A. H. Mohsin, A. A. Zaidan, B. B. Zaidan, O. S. Albahri, A. S. Albahri, M. A. Alsalem, and K. I. Mohammed, “Based blockchain-PSO-AES techniques in finger vein biometrics: A novel verification secure framework for patient authentication,” *Comput. Standards Interfaces*, vol. 66, Oct. 2019, Art. no. 103343.

[40] M. Vaidehi and B. J. Rabi, “Design and analysis of AES-CBC mode for high security applications,” in *Proc. 2nd Int. Conf. Current Trends Eng. Technol. (ICCTET)*, Jul. 2014, pp. 499–502.

[41] S. Aviran, P. H. Siegel, and J. K. Wolf, “An improvement to the bit stuffing algorithm,” *IEEE Trans. Inf. Theory*, vol. 51, no. 8, pp. 2885–2891, Aug. 2005.

[42] R. N. Grass, R. Heckel, M. Puddu, D. Paunescu, and W. J. Stark, “Robust chemical preservation of digital information on DNA in silica with error-correcting codes,” *Angew. Chem. Int. Ed.*, vol. 54, no. 8, pp. 2552–2555, Feb. 2015.

[43] S. M. H. T. Yazdi, H. M. Kiah, E. Garcia-Ruiz, J. Ma, H. Zhao, and O. Milenkovic, “DNA-based storage: Trends and methods,” *IEEE Trans. Mol., Biol. Multi-Scale Commun.*, vol. 1, no. 3, pp. 230–248, Sep. 2015.

[44] H. H. Lee, R. Kalhor, N. Goela, J. Bolot, and G. M. Church, “Terminator-free template-independent enzymatic DNA synthesis for digital information storage,” *Nature Commun.*, vol. 10, no. 1, pp. 1–12, Jun. 2019.

[45] R. Tagore, *Gitanjali*. Hamburg, Germany: Tredition Classics, 2012.

<figure><img src="image_12.png" /></figure>

**CHLOÉ BERTON** received the B.Sc. degree in mathematics from the University of Rennes, France, in 2018, the M.Sc. degree in information security and cryptology from the University of Limoges, France, in 2020, and the Ph.D. degree from the IMT Atlantique, Laboratory of Medical Information Processing, INSERM U1101, and CyberHealth Team, Brest, France, in 2024, focusing on data confidentiality and DNA data storage.

Since then, she has been a Postdoctoral Researcher with IMT Atlantique, focusing on data watermarking and security of data stored in DNA. Her research interests include cybersecurity, data privacy and traceability, post-quantum cryptography, and data storage into DNA molecules.

<figure><img src="image_13.png" /></figure>

**GOUENOU COATRIEUX** (Senior Member, IEEE) is a Full Professor with the IMT Atlantique, Brest, France. He conducts his research with the Laboratory of Medical Information Processing, INSERM UMR1101, Brest, where he leads the Cyber Health Research Team. He is also the Head of the INSERM Industrial Chair, CYBAILE on Cybersecurity and Trusted Artificial Intelligence in Healthcare. His primary research interests include watermarking, crypto-watermarking,

secure processing of data, digital forensics, and the security of DNA data storage.

Dr. Coatrieux is/was a member of the International Federation for Medical and Biological Engineering “Global Citizen Safety and Security Working Group”; and European Federation for Medical Informatics “Security, Safety, and Ethics Working Group.” He has contributed to the Technical Committee of “Information Technology for Health” of the IEEE EMB Society. He was an Associate Editor of *Innovation and Research in Bio-Medical*; and a past Associate Editor of *Engineering, IEEE JOURNAL ON BIOMEDICAL AND HEALTH INFORMATICS*, and *Digital Signal Processing*.

<figure><img src="image_14.png" /></figure>

**HÉLÉNE GASNIER** received the B.Sc. degree in mathematics from the University of Angers, France, in 2021, and the M.Sc. degree in mathematics of information, cryptography from the University of Rennes, France, in 2023. She is currently pursuing the Ph.D. degree with the IMT Atlantique, Laboratory of Medical Information Processing, INSERM U1101 and CyberHealth Team, Brest, France, focusing on traceability of data in the context of DNA data storage.

Her research interests include cryptography, side channel attacks, molecular data storage, and data security, particularly data traceability.

<figure><img src="image_15.png" /></figure>

**SAHAR HADDAD** received the Ph.D. degree, specializing in the protection of encrypted and compressed medical images through watermarking, in 2020. After her graduation, she joined IMT Atlantique, as a Postdoctoral Researcher, focusing on the protection of medical data. Later, she became a Research Engineer with INSERM, where she managed a team and different projects dedicated to the protection of exchanged and stored sensitive medical data. Currently, she is a

Cybersecurity Expert for IoT devices with Witekio, an Avnet Company. Her team is ISO 27001 certified and employs a “secure by design” approach to ensure their clients’ peace of mind.

<figure><img src="image_16.png" /></figure>

**REDA BELLAFQIRA** (Member, IEEE) received the M.Sc. degree in information security and cryptology from the University of Limoges, Limoges, France, in 2014, and the Ph.D. degree from the IMT Atlantique Bretagne-Pays de la Loire, Brest, France, in 2017.

Since 2018, he has been a Postdoctoral Researcher with the Laboratory of Medical Information Processing, INSERM UMR 1101. He is currently an Associate Professor with the

Department of Data Science, IMT Atlantique, and conducts his research activities with the Laboratory of Medical Information Processing, INSERM UMR 1101, and the Joint Laboratory of Security and Processing of Externalized Medical Image Data (SePEMeD). His research interests include data security, with a particular interests in protecting medical images and database from malicious entities and service providers using cryptographic and watermarking tools.

<figure><img src="image_17.png" /></figure>

**DOMINIQUE LAVENIER** is a Senior CNRS (French National Center for Scientific Research) Researcher; and a member of the GenScale Bioinformatics Team, IRISA/INRIA, Rennes, created in 2012. His current research interests include bioinformatics, data structures, genomics, parallelism, optimization algorithms, processing-in-memory, and DNA storage. He is currently leading the dnarXiv project, whose goal is to explore various strategies for archiving information on DNA.