Exemplo n.º 1
0
 def runTest(self):
     #Check plain_text properly stored
     c = ck.Converter()
     self.assertEquals(c.get_plain(1), 'b', "Expected 'b'")
     self.assertEquals(c.get_plain(25), 'z', "Expected 'z'")
     self.assertEquals(c.get_plain(27), 'B', "Expected 'B'")
     self.assertEquals(c.get_plain(51), 'Z', "Expected 'Z'")
Exemplo n.º 2
0
 def encrypt(self, plain_text, secret_key):
     conv = ck.Converter()
     conv.set_key(secret_key) 
     num_text = self.numeric_encode(plain_text)
     cypher_text = []
     for n in num_text:
         cypher_text.append(conv.get_key(n))
     return(cypher_text)
Exemplo n.º 3
0
 def runTest(self):
     #Check key is stored and retrieved properly
     c = ck.Converter()
     k = [
         'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd',
         'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm',
         'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D',
         'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M'
     ]
     c.set_key(k)
     self.assertEquals(c.get_key(1), 'w', "Expected 'w'")
     self.assertEquals(c.get_key(25), 'm', "Expected 'm'")
     self.assertEquals(c.get_key(27), 'W', "Expected 'W'")
     self.assertEquals(c.get_key(51), 'M', "Expected 'M'")
Exemplo n.º 4
0
 def runTest(self):
     #Create object to hold the key
     c = ck.Converter()
     self.assertEqual(len(c.converter), 53,
                      "Expected 52 keys in Converter object")