Software
This article will explain in detail how the software part of
CryptoGErM works. To encrypt the message and translate it to DNA we
wrote several Javascripts. They are used in the demonstration of our
software on the Coding page.
The following sections cover the same steps the software takes to
turn a text into DNA. First encryption, then translation to DNA
and finally packing it into a complete message sequence. The
examples will use Hello world
as the message text, and
secret
for the encryption key.
The software is divided into several modules, each in their own file. Every module creates a variable that contains the functionality that it provides. Two of the modules were not written by us, but used under an open source license. The AES module was written by Chris Veness at Movable-Type.co.uk. The CRC implementation was written by Github user chitchcock and published as Github Gist #5112270. All other code was written by us and is licensed under the MIT license.
Encryption & Decryption
For the encryption we don't use the AES
module
directly, but the AES.Ctr
module. AES.Ctr
implements the AES counter mode of operation. This allows us to
encrypt messages of arbitrary length, rather than a fixed length of
256 bits, which is around 32 letters.
AES counter mode also adds randomness to the message. So the encrypted text is always different, even when the same message is encrypted multiple times. When the message is decrypted these random bits are removed, so the output message after decryption is still the same as the original.
Encrypting our example message Hello world
with the
key secret
could result in this encrypted
text: =�¼iõÚW�èu,�*õC�
.
The AES module is in aes.js and the counter mode addition is in aes-ctr.js.
DNA
Translation to DNA is done by two modules: DNA
and
EightBit
. The EightBit
module translates
letters, digits and punctuation into eight-bit numbers: from 0 to
255 and DNA
translates those numbers into DNA sequences.
When the message is encrypted it is turned into a sequence of random looking symbols