コード例 #1
0
    def test_ColumnarTestAnalysis3(self):
        algorithm = Columnar()
        key1 = algorithm.Analyse(self.mainPlain3, self.mainCipher4)
        key2 = algorithm.Analyse(self.mainPlain4, self.mainCipher5)

        for i in range(len(self.mainkey2)):
            self.assertTrue((self.mainkey2[i] == key1[i]) or (self.mainkey2[i] == key2[i]))
コード例 #2
0
 def test_ColumnarNewTestAnalysis(self):
     algorithm = Columnar()
     key1 = algorithm.Analyse(self.newPlain, self.newCipher)
     for i in range(len(self.newKey)):
         self.assertEqual(self.newKey[i], key1[i])
コード例 #3
0
 def test_ColumnarNewTestDec(self):
     algorithm = Columnar()
     plain1 = algorithm.Decrypt(self.newCipher, self.newKey)
     self.assertEqual(plain1, self.newPlain)
コード例 #4
0
 def test_ColumnarNewTestEnc(self):
     algorithm = Columnar()
     cipher = algorithm.Encrypt(self.newPlain, self.newKey)
     self.assertEqual(cipher, self.newCipher)
コード例 #5
0
    def test_ColumnarTestAnalysis2(self):
        algorithm = Columnar()
        key = algorithm.Analyse(self.mainPlain3, self.mainCipher3)

        for i in range(len(self.mainkey1)):
            self.assertEqual(self.mainkey1[i], key[i])
コード例 #6
0
 def test_ColumnarTestDec2(self):
     algorithm = Columnar()
     plain = algorithm.Decrypt(self.mainCipher3, self.mainkey1)
     self.assertEqual(plain, self.mainPlain3)
コード例 #7
0
 def test_ColumnarTestDec3(self):
     algorithm = Columnar()
     plain1 = algorithm.Decrypt(self.mainCipher4, self.mainkey2)
     plain2 = algorithm.Decrypt(self.mainCipher5, self.mainkey2)
     self.assertTrue((plain1 ==  self.mainPlain3) or (plain2 == self.mainPlain4))
コード例 #8
0
 def test_ColumnarTestEnc3(self):
     algorithm = Columnar()
     cipher = algorithm.Encrypt(self.mainPlain3, self.mainkey2)
     self.assertTrue((cipher == self.mainCipher4) or (cipher == self.mainCipher5))
コード例 #9
0
 def test_ColumnarTestEnc2(self):
     algorithm = Columnar()
     cipher = algorithm.Encrypt(self.mainPlain3, self.mainkey1)
     self.assertEqual(cipher, self.mainCipher3)
コード例 #10
0
 def test_ColumnarTestAnalysis1(self):
     algorithm = Columnar()
     key1 = algorithm.Analyse(self.mainPlain1, self.mainCipher1)
     key2 = algorithm.Analyse(self.mainPlain2, self.mainCipher2)
     for i in range(len(self.mainkey)):
         self.assertTrue((self.mainkey[i] == key1[i]) or (self.mainkey[i] == key2[i]))
コード例 #11
0
    def test_ColumnarTestDec1(self):
        algorithm = Columnar()
        plain1 = algorithm.Decrypt(self.mainCipher1, self.mainkey)
        plain2 = algorithm.Decrypt(self.mainCipher2, self.mainkey)

        self.assertTrue((plain1 == self.mainPlain1) or (plain2 == self.mainPlain2))
コード例 #12
0
 def test_ColumnarTestEnc1(self):
     algorithm = Columnar()
     cipher = algorithm.Encrypt(self.mainPlain1, self.mainkey)
     # Add x's or not
     self.assertTrue((cipher == self.mainCipher1) or (cipher == self.mainCipher2))