diff --git a/modules/encoders/cipher/dna/dna.pp b/modules/encoders/cipher/dna/dna.pp new file mode 100644 index 000000000..e69de29bb diff --git a/modules/encoders/cipher/dna/manifests/.no_puppet b/modules/encoders/cipher/dna/manifests/.no_puppet new file mode 100644 index 000000000..e69de29bb diff --git a/modules/encoders/cipher/dna/secgen_local/local.rb b/modules/encoders/cipher/dna/secgen_local/local.rb new file mode 100644 index 000000000..65dd4b1ce --- /dev/null +++ b/modules/encoders/cipher/dna/secgen_local/local.rb @@ -0,0 +1,67 @@ +#!/usr/bin/ruby +require_relative '../../../../../lib/objects/local_string_encoder.rb' +class DNACipher < StringEncoder + attr_accessor :char_map + + def initialize + super + self.module_name = 'DNA Cipher Encoder' + self.strings_to_encode = [] + self.char_map = { + 'A' => 'CGA', + 'B' => 'CCA', + 'C' => 'GTT', + 'D' => 'TTG', + 'E' => 'GGC', + 'F' => 'GGT', + 'G' => 'TTT', + 'H' => 'CGC', + 'I' => 'ATG', + 'J' => 'AGT', + 'K' => 'AAG', + 'L' => 'TGC', + 'M' => 'TCC', + 'N' => 'TCT', + 'O' => 'GGA', + 'P' => 'GTG', + 'Q' => 'AAC', + 'R' => 'TCA', + 'S' => 'ACG', + 'T' => 'TTC', + 'U' => 'CTG', + 'V' => 'CCT', + 'W' => 'CCG', + 'X' => 'CTA', + 'Y' => 'AAA', + 'Z' => 'CTT', + ' ' => 'ATA', + ',' => 'TCG', + '.' => 'GAT', + ':' => 'GCT', + '0' => 'ACT', + '1' => 'ACC', + '2' => 'TAG', + '3' => 'GCA', + '4' => 'GAG', + '5' => 'AGA', + '6' => 'TTA', + '7' => 'ACA', + '8' => 'AGG', + '9' => 'GCG', + '{' => '{', + '}' => '}', + '_' => '_', + } + end + + def encode(str) + encoded = [] + str.each_char do |char| + self.char_map.key? char.upcase + encoded << self.char_map[char.upcase] + end + encoded.join + end +end + +DNACipher.new.run \ No newline at end of file diff --git a/modules/encoders/cipher/dna/secgen_metadata.xml b/modules/encoders/cipher/dna/secgen_metadata.xml new file mode 100644 index 000000000..086da70d6 --- /dev/null +++ b/modules/encoders/cipher/dna/secgen_metadata.xml @@ -0,0 +1,30 @@ + + + + DNA Cipher + Thomas Shaw + MIT + + + + alpha_reversible + dna_encoder + cipher_encoder + linux + windows + + http://www.polestarltd.com/ttg/isspeeches/051403/slide14.jpg + + Guanine, Adenine, Thymine and Cytosine + http://www.polestarltd.com/ttg/isspeeches/051403/slide14.jpg + + strings_to_encode + + + + + + encoded_string +