Difference between revisions of "Team:Groningen/Software"

Line 8: Line 8:
 
CryptoGErM works. To encrypt the message and translate it to DNA we  
 
CryptoGErM works. To encrypt the message and translate it to DNA we  
 
wrote several Javascripts. They are used in the demonstration of our
 
wrote several Javascripts. They are used in the demonstration of our
software on the <a href="/Team:Groningen/Coding">Coding</a> page.</p>
+
software on the <a href="/Team:Groningen/Coding">Coding</a> 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 <code>Hello world</code> as the message text, and
 +
<code>secret</code> for the encryption key.</p>
 
 
 
<p>The software is divided into several modules, each in their own
 
<p>The software is divided into several modules, each in their own
Line 24: Line 29:
 
<h3>Encryption &amp; Decryption</h3>
 
<h3>Encryption &amp; Decryption</h3>
 
 
<p>For the encryption we don't use the <code>AES</code> module directly, but
+
<p>For the encryption we don't use the <code>AES</code> module  
the <code>AES.Ctr</code> module. <code>AES.Ctr</code> implements the AES counter mode of
+
directly, but the <code>AES.Ctr</code> module. <code>AES.Ctr</code>  
operation. This allows us to encrypt messages of arbitrary length,
+
implements the AES counter mode of operation. This allows us to  
rather than a fixed length of 256 bits, which is around 32 letters.</p>
+
encrypt messages of arbitrary length, rather than a fixed length of  
 +
256 bits, which is around 32 letters.</p>
 
 
 
<p>AES counter mode also adds randomness to the message. So the
 
<p>AES counter mode also adds randomness to the message. So the
 
encrypted text is always different, even when the same message is
 
encrypted text is always different, even when the same message is
 
encrypted multiple times. When the message is decrypted these random
 
encrypted multiple times. When the message is decrypted these random
bits are removed, so the output message is still the same as the
+
bits are removed, so the output message after decryption is still  
input.</p>
+
the same as the original.</p>
 +
 +
<p>Encrypting our example message <code>Hello world</code> with the
 +
key <code>secret</code> could result in this encrypted
 +
text: <code>w�}¼j™ÚWÆ�ƪ�"�P•ï</code>.</p>
 
 
 
<p>The AES module is in <a href="/Template:Groningen/aes_js?action=raw&ctype=text/javascript">aes.js</a>
 
<p>The AES module is in <a href="/Template:Groningen/aes_js?action=raw&ctype=text/javascript">aes.js</a>
Line 44: Line 54:
 
<p>Translation to DNA is done by two modules: <code>DNA</code> and
 
<p>Translation to DNA is done by two modules: <code>DNA</code> and
 
<code>EightBit</code>. The <code>EightBit</code> module translates
 
<code>EightBit</code>. The <code>EightBit</code> module translates
letters into eight-bit numbers: from 0 to 255 and <code>DNA</code>  
+
letters, digits and punctuation into eight-bit numbers: from 0 to  
translates those numbers into DNA sequences.</p>
+
255 and <code>DNA</code> translates those numbers into DNA sequences.</p>
 +
 +
<p>When the message is encrypted it is turned into a sequence of
 +
random looking symbols
 
</section>
 
</section>
 
</article>
 
</article>
 
</html>
 
</html>
 
{{Groningen/footer}}
 
{{Groningen/footer}}

Revision as of 12:52, 15 September 2016

CryptoGE®M
Team
Project
Biology
Computing
Human Practice
Acknowledgements

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: w�}¼j™ÚWÆ�ƪ�"�P•ï.

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

Oop top