Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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())