Dna and Cryptography

title: DNAs in Cryptography. type: posts

Found a pretty cool paper this week - A New Hybrid Cryptosystem Involving DNA, Rabin, One Time Pad and Fiestel (opens in a new tab). Thought I'd discuss it.

This paper proposes a novel approach to cryptography by combining DNA sequences, the Rabin cryptosystem, one-time pad (OTP), and a Feistel structure. DNA cryptography provides several advantages that enhance the security of traditional methods. Why DNA?

  • Extremely large keyspace - DNA sequences of length nn have 4n4^n possible combinations, enabling an astronomically large number of keys. Even relatively short DNA strands can have keyspaces infeasible for brute force attacks.
  • True randomness - Biologically generated DNA sequences exhibit more randomness than computationally generated keys, improving cryptographic security.
  • Availability - Many websites provide randomly generated DNA sequences that can be readily used as cryptographic keys.
  • Compact storage - DNA can store vast amounts of data at a molecular scale, allowing the use of large keys in a small footprint.

Feistel Network The Feistel structure splits the input data into two halves and works through multiple rounds of substitution and permutation (confusion and diffusion) on the halves to scramble the data thoroughly.

Rabin key-gen, encryption, decryption The Rabin cryptosystem is a public-key cryptosystem based on the difficulty of factorizing large composite numbers into their prime factors. It was invented by Michael O. Rabin in 1979. The scheme consists of four algorithms: Key Generation, Encryption, Decryption, and Primality Testing.

The Rabin cryptosystem can be defined as follows:

  1. Key Generation:

    • Choose two distinct prime numbers, pp and qq, of equal length such that pβ‰ qp \neq q.
    • Compute the modulus N=pβ‹…qN = p \cdot q.
    • The public key is the modulus NN.
    • The private key consists of the prime factors pp and qq.
  2. Encryption:

    • Convert the plaintext message MM into an integer representation.
    • Compute the ciphertext CC as C=M2mod  NC = M^2 \mod N.
  3. Decryption:

    • Compute the four possible square roots of the ciphertext CC modulo NN.
    • The four possible plaintexts M1,M2,M3,M4M_1, M_2, M_3, M_4 are given by Mi=Cmod  NM_i = \sqrt{C} \mod N, for i=1,2,3,4i = 1,2,3,4.
  4. Primality Testing:

    • To verify the primality of an integer xx, check if xNβˆ’12≑1mod  Nx^{\frac{N-1}{2}} \equiv 1 \mod N or xNβˆ’12β‰‘βˆ’1mod  Nx^{\frac{N-1}{2}} \equiv -1 \mod N. If neither condition holds, NN is composite.

The security of the Rabin cryptosystem relies on the difficulty of factoring the modulus NN into its prime factors. To ensure secure communication, the prime factors pp and qq must be kept secret.

The Rabin cryptosystem has certain vulnerabilities related to its deterministic nature, such as the existence of non-trivial square roots of ciphertexts. To address these issues, additional steps and techniques, such as padding and digital signatures, can be incorporated into the scheme.

The algorithm discussed

Key Generation:

  1. Sender generates a random DNA sequence to be used as a one-time pad (OTP) key.
  2. Receiver generates a public/private key pair for the Rabin cryptosystem. Sends the public key to sender.


  1. Sender preprocesses plaintext by inserting a "spy" character at the start of each character.
  2. Convert plaintext characters to ASCII values, concatenate pairs of ASCII values.
  3. Encrypt the ASCII values with Rabin encryption using receiver's public key.
  4. Convert the Rabin ciphertext to binary.
  5. XOR the binary ciphertext with the random DNA OTP key.
  6. Rearrange the XOR output using a Feistel network structure.
  7. Send the rearranged ciphertext to the receiver.


  1. Receiver reverses the Feistel network scrambling.
  2. XORs the result with the DNA OTP key to undo that step.
  3. Decrypts the Rabin ciphertext using private key. Gets 4 possibilities for each.
  4. Checks "spy" character to select the correct plaintext from the 4 options.
  5. Removes "spy" characters and converts ASCII values back to characters.

This achieves a high level of security by combining the strengths of all the components - DNA key randomness, Rabin asymmetric encryption, OTP unbreakability, and Feistel structure scrambling.

TL;DR (Thanks GPT!)

  • Proposes new encryption method combining DNA sequences, Rabin cryptosystem, one-time pad (OTP), and Feistel structure.

  • DNA sequences used as cryptographic keys provide massive keyspace, true randomness, availability, and compact storage. Harder to crack.

  • Rabin public-key encryption used for asymmetric crypto. Computational security based on factoring large semi-primes.

  • OTP with DNA key gives unbreakable security through XORing.

  • Feistel structure adds confusion through multiple rounds of substituting and shuffling halves.

  • Hybrid system leverages strengths of each: DNA randomness/keyspace, Rabin math security, OTP unbreakability, Feistel confusion.

  • Goal is very secure cipher resistant to various crypto attacks by synergizing different techniques.