예제 #1
0
 def test_encipher(self):
     keys = (3, 6, 7, 8)
     plaintext = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
     ciphertext = ('aeimquycgkoswbdfhjlnprtvxzbdfhjlnprtvxzcgkoswaeimquy',
                   'akueoybjltvdfnpxzcimswcgmqwdhnrxbhlrvegoqyaiksufpzjt',
                   'amykwblnxzjlvxckowaimuydjpvbhntzeiqucgosfhrtdfprgseq',
                   'aocqbnpbdprcmqaeosdlrzfnteksygmufjtxhlvzgiuwikwyhvjx')
     for i, key in enumerate(keys):
         enc = Railfence(key).encipher(plaintext)
         self.assertEqual(enc.upper(), ciphertext[i].upper())
예제 #2
0
 def test_encipher(self):
     keys = (3,6,7,8)
     plaintext = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
     ciphertext = ('aeimquycgkoswbdfhjlnprtvxzbdfhjlnprtvxzcgkoswaeimquy',
                   'akueoybjltvdfnpxzcimswcgmqwdhnrxbhlrvegoqyaiksufpzjt',
                   'amykwblnxzjlvxckowaimuydjpvbhntzeiqucgosfhrtdfprgseq',
                   'aocqbnpbdprcmqaeosdlrzfnteksygmufjtxhlvzgiuwikwyhvjx')
     for i,key in enumerate(keys):
         enc = Railfence(key).encipher(plaintext)
         self.assertEqual(enc.upper(), ciphertext[i].upper())
예제 #3
0
 def test_decipher(self):
     keys = (3, 6, 7, 8)
     ciphertext = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
     plaintext = ('annobpoqcrpsdtquevrwfxsygztahbucidvejfwgkhxiljykmlzm',
                  'agrblvmcshbitdnwoeujckvfpxqgwldmxhrysiyneozjtzukapfq',
                  'afoxgowphypgbhqziqxrjaricjsbksytlctkdludmuzvnevmenwf',
                  'aelszgowphatmfbgnubiqxrjcvohcipwdksytlexqjdkryfmuzvn')
     for i, key in enumerate(keys):
         dec = Railfence(key).decipher(ciphertext)
         self.assertEqual(dec.upper(), plaintext[i].upper())
예제 #4
0
 def test_decipher(self):
     keys = (3,6,7,8)
     ciphertext = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
     plaintext = ('annobpoqcrpsdtquevrwfxsygztahbucidvejfwgkhxiljykmlzm',
                  'agrblvmcshbitdnwoeujckvfpxqgwldmxhrysiyneozjtzukapfq',
                  'afoxgowphypgbhqziqxrjaricjsbksytlctkdludmuzvnevmenwf',
                  'aelszgowphatmfbgnubiqxrjcvohcipwdksytlexqjdkryfmuzvn')
     for i,key in enumerate(keys):
         dec = Railfence(key).decipher(ciphertext)
         self.assertEqual(dec.upper(), plaintext[i].upper())