Line 59: | Line 59: | ||
</div> | </div> | ||
</div> | </div> | ||
+ | |||
+ | <p id="desc"></p> | ||
<p> | <p> | ||
Line 107: | Line 109: | ||
elErr = document.getElementById('err'), | elErr = document.getElementById('err'), | ||
elCur = document.getElementById('cur'), | elCur = document.getElementById('cur'), | ||
+ | elDesc = document.getElementById('desc'), | ||
elStage = document.getElementById('stage'); | elStage = document.getElementById('stage'); | ||
var subCoding = EightBit, doCrypt = false, lastEdit = elMsg, | var subCoding = EightBit, doCrypt = false, lastEdit = elMsg, | ||
cryptBits = 256, stages = [ | cryptBits = 256, stages = [ | ||
− | {name: "Plain text", transform: function(prev){ // null | + | {name: "Plain text", description: "A message that has not "+ |
+ | "been encrypted is called 'plain text'. The first "+ | ||
+ | "step in the CryptoGErM process is to encrypt the "+ | ||
+ | "message. To do this, click the Transform button.", | ||
+ | transform: function(prev){ // null | ||
return elMsg.value; | return elMsg.value; | ||
} | } | ||
}, | }, | ||
− | {name: "Encrypted", transform: function(prev){ // plain msg | + | {name: "Encrypted", description: "The message is now "+ |
+ | "encrypted with your secret password and looks like "+ | ||
+ | "gibberish. This is called the cipher text. The "+ | ||
+ | "cipher text now needs to be transformed into "+ | ||
+ | "DNA. For this we need to translate the letters "+ | ||
+ | "and other symbols to numbers. Fortunately, "+ | ||
+ | "computers already do this via an encoding "+ | ||
+ | "scheme called ASCII. Click the Transform button "+ | ||
+ | "again to translate the ciper text into ASCII.", | ||
+ | transform: function(prev){ // plain msg | ||
var key = elKey.value; | var key = elKey.value; | ||
return Aes.Ctr.encrypt(prev, key, cryptBits); | return Aes.Ctr.encrypt(prev, key, cryptBits); | ||
Line 122: | Line 138: | ||
} | } | ||
}, | }, | ||
− | {name: "ASCII", display: function(data){ // crypt msg | + | {name: "ASCII", description: "Each number here is a letter "+ |
+ | "or symbol from the previous step. ASCII uses 8 "+ | ||
+ | "binary digits (bits) to represent letters & "+ | ||
+ | "symbols, this means it can have 256 different "+ | ||
+ | "values. DNA only has 4 different letters, so we "+ | ||
+ | "need to split each ASCII value up into 4 bases. "+ | ||
+ | "The easiest way to do this is to look at the "+ | ||
+ | "binary. Click the Transform button once more to "+ | ||
+ | "do this.", | ||
+ | display: function(data){ // crypt msg | ||
return data.split('').map(function(c){ | return data.split('').map(function(c){ | ||
return c.charCodeAt(0).toString(10).padStart(3, '0'); | return c.charCodeAt(0).toString(10).padStart(3, '0'); | ||
Line 128: | Line 153: | ||
} | } | ||
}, | }, | ||
− | {name: "Binary", display: function(data){ // crypt msg | + | {name: "Binary", description: "These binary digits can now "+ |
+ | "easily be translated to DNA bases. 00 becomes A, "+ | ||
+ | "01 becomes C, 10 becomes T and 11 becomes G. In "+ | ||
+ | "the translating process the binary numbers are "+ | ||
+ | "reversed. You need to read the binary from "+ | ||
+ | "right-to-left but it is turned left-to-right in "+ | ||
+ | "DNA. For example: 11100100 becomes ACTG, not GTCA."+ | ||
+ | "Click the Transform button to see the DNA of your "+ | ||
+ | "cipher text.", | ||
+ | display: function(data){ // crypt msg | ||
return data.split('').map(function(c){ | return data.split('').map(function(c){ | ||
return c.charCodeAt(0).toString(2).padStart(8, '0'); | return c.charCodeAt(0).toString(2).padStart(8, '0'); | ||
Line 134: | Line 168: | ||
} | } | ||
}, | }, | ||
− | {name: "DNA", transform: function(prev){ // crypt msg | + | {name: "DNA", description: "The encrypted message has now "+ |
+ | "been turned into DNA. But we're not completely "+ | ||
+ | "done yet. A few things need to be put around the "+ | ||
+ | "message so the decoding & decryption system "+ | ||
+ | "can find the message and know if it is still "+ | ||
+ | "intact. Also, certain sequences of DNA may not "+ | ||
+ | "occur in the final sequence, or the organism may "+ | ||
+ | "not-so-accidentally destroy the message. All these "+ | ||
+ | "things are taken care of by putting a header in "+ | ||
+ | "front of the message with information about the "+ | ||
+ | "message. The final step takes care of this. Click "+ | ||
+ | "the Transform button one more time to see the "+ | ||
+ | "final DNA sequence that can be put into a bacteria.", | ||
+ | transform: function(prev){ // crypt msg | ||
return EightBit.encodeStr(prev); | return EightBit.encodeStr(prev); | ||
}, display: function(data){ | }, display: function(data){ | ||
Line 140: | Line 187: | ||
} | } | ||
}, | }, | ||
− | {name: "Message", transform: function(prev){ // dna msg | + | {name: "Message", description: "Here is the final message "+ |
+ | "block that can be integrated straight into a "+ | ||
+ | "bacteria. Because of the way that the encryption "+ | ||
+ | "mechanism works, the cipher text is different "+ | ||
+ | "every time you do it, even if you encrypt the "+ | ||
+ | "same message. You may click the Transform button "+ | ||
+ | "again to see the whole process again, but with "+ | ||
+ | "different values.", | ||
+ | transform: function(prev){ // dna msg | ||
return Message.packDNA(prev); | return Message.packDNA(prev); | ||
} | } |
Revision as of 14:08, 26 August 2016
Encryption
Enter the message you want to secure here
Message
Key
Enter your secret key/password here