コード例 #1
0
ファイル: aes256.py プロジェクト: pascalbertrand/aes
 def setUp(self):
     #routines signatures
     self.set_encrypt_keys = aes.AesKeyFunc(("aes256_set_encrypt_keys",
                                             aes.aes256))
     self.set_decrypt_keys = aes.AesKeyFunc(("aes256_set_decrypt_keys",
                                             aes.aes256))
     self.encrypt_block = aes.AesBlockFunc(("aes256_encrypt_block",
                                             aes.aes256))
     self.decrypt_block = aes.AesBlockFunc(("aes256_decrypt_block",
                                             aes.aes256))
     self.get_keys = aes.AesRoundKeysFunc(("aes256_get_keys", aes.test_util))
     self.set_keys = aes.AesRoundKeysFunc(("aes_set_keys", aes.test_util))
     #test values
     key, text, cypher = (
         "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
         "00112233445566778899aabbccddeeff",
         "8ea2b7ca516745bfeafc49904b496089")
     encryption_keys = (
         "000102030405060708090a0b0c0d0e0f",
         "101112131415161718191a1b1c1d1e1f",
         "a573c29fa176c498a97fce93a572c09c",
         "1651a8cd0244beda1a5da4c10640bade",
         "ae87dff00ff11b68a68ed5fb03fc1567",
         "6de1f1486fa54f9275f8eb5373b8518d",
         "c656827fc9a799176f294cec6cd5598b",
         "3de23a75524775e727bf9eb45407cf39",
         "0bdc905fc27b0948ad5245a4c1871c2f",
         "45f5a66017b2d387300d4d33640a820a",
         "7ccff71cbeb4fe5413e6bbf0d261a7df",
         "f01afafee7a82979d7a5644ab3afe640",
         "2541fe719bf500258813bbd55a721c0a",
         "4e5a6699a9f24fe07e572baacdf8cdea",
         "24fc79ccbf0979e9371ac23c6d68de36")
     decryption_keys = (
         "000102030405060708090a0b0c0d0e0f",
         "1a1f181d1e1b1c191217101516131411",
         "2a2840c924234cc026244cc5202748c4",
         "7fd7850f61cc991673db890365c89d12",
         "15c668bd31e5247d17c168b837e6207c",
         "aed55816cf19c100bcc24803d90ad511",
         "de69409aef8c64e7f84d0c5fcfab2c23",
         "f85fc4f3374605f38b844df0528e98e1",
         "3ca69715d32af3f22b67ffade4ccd38e",
         "74da7ba3439c7e50c81833a09a96ab41",
         "b5708e13665a7de14d3d824ca9f151c2",
         "c8a305808b3f7bd043274870d9b1e331",
         "5e1648eb384c350a7571b746dc80e684",
         "34f1d1ffbfceaa2ffce9e25f2558016e",
         "24fc79ccbf0979e9371ac23c6d68de36")
     self.key = aes.AesKey(*aes.hex_to_val(key))
     self.text, self.cypher = map(aes.hex_to_block, (text, cypher))
     self.encrypt_round_keys, self.decrypt_round_keys = (
         aes.AesRoundKeys(*aes.hex_list_to_block_list(encryption_keys)),
         aes.AesRoundKeys(*aes.hex_list_to_block_list(decryption_keys)))
コード例 #2
0
ファイル: aes256.py プロジェクト: tornadory/aes
 def setUp(self):
     #routines signatures
     self.set_encrypt_keys = aes.AesKeyFunc(
         ("aes256_set_encrypt_keys", aes.aes256))
     self.set_decrypt_keys = aes.AesKeyFunc(
         ("aes256_set_decrypt_keys", aes.aes256))
     self.encrypt_block = aes.AesBlockFunc(
         ("aes256_encrypt_block", aes.aes256))
     self.decrypt_block = aes.AesBlockFunc(
         ("aes256_decrypt_block", aes.aes256))
     self.get_keys = aes.AesRoundKeysFunc(
         ("aes256_get_keys", aes.test_util))
     self.set_keys = aes.AesRoundKeysFunc(("aes_set_keys", aes.test_util))
     #test values
     key, text, cypher = (
         "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
         "00112233445566778899aabbccddeeff",
         "8ea2b7ca516745bfeafc49904b496089")
     encryption_keys = ("000102030405060708090a0b0c0d0e0f",
                        "101112131415161718191a1b1c1d1e1f",
                        "a573c29fa176c498a97fce93a572c09c",
                        "1651a8cd0244beda1a5da4c10640bade",
                        "ae87dff00ff11b68a68ed5fb03fc1567",
                        "6de1f1486fa54f9275f8eb5373b8518d",
                        "c656827fc9a799176f294cec6cd5598b",
                        "3de23a75524775e727bf9eb45407cf39",
                        "0bdc905fc27b0948ad5245a4c1871c2f",
                        "45f5a66017b2d387300d4d33640a820a",
                        "7ccff71cbeb4fe5413e6bbf0d261a7df",
                        "f01afafee7a82979d7a5644ab3afe640",
                        "2541fe719bf500258813bbd55a721c0a",
                        "4e5a6699a9f24fe07e572baacdf8cdea",
                        "24fc79ccbf0979e9371ac23c6d68de36")
     decryption_keys = ("000102030405060708090a0b0c0d0e0f",
                        "1a1f181d1e1b1c191217101516131411",
                        "2a2840c924234cc026244cc5202748c4",
                        "7fd7850f61cc991673db890365c89d12",
                        "15c668bd31e5247d17c168b837e6207c",
                        "aed55816cf19c100bcc24803d90ad511",
                        "de69409aef8c64e7f84d0c5fcfab2c23",
                        "f85fc4f3374605f38b844df0528e98e1",
                        "3ca69715d32af3f22b67ffade4ccd38e",
                        "74da7ba3439c7e50c81833a09a96ab41",
                        "b5708e13665a7de14d3d824ca9f151c2",
                        "c8a305808b3f7bd043274870d9b1e331",
                        "5e1648eb384c350a7571b746dc80e684",
                        "34f1d1ffbfceaa2ffce9e25f2558016e",
                        "24fc79ccbf0979e9371ac23c6d68de36")
     self.key = aes.AesKey(*aes.hex_to_val(key))
     self.text, self.cypher = map(aes.hex_to_block, (text, cypher))
     self.encrypt_round_keys, self.decrypt_round_keys = (
         aes.AesRoundKeys(*aes.hex_list_to_block_list(encryption_keys)),
         aes.AesRoundKeys(*aes.hex_list_to_block_list(decryption_keys)))
コード例 #3
0
ファイル: aes192.py プロジェクト: pascalbertrand/aes
 def setUp(self):
     #routines signatures
     self.set_encrypt_keys = aes.AesKeyFunc(("aes192_set_encrypt_keys",
                                             aes.aes192))
     self.set_decrypt_keys = aes.AesKeyFunc(("aes192_set_decrypt_keys",
                                             aes.aes192))
     self.encrypt_block = aes.AesBlockFunc(("aes192_encrypt_block",
                                            aes.aes192))
     self.decrypt_block = aes.AesBlockFunc(("aes192_decrypt_block",
                                            aes.aes192))
     self.get_keys = aes.AesRoundKeysFunc(("aes192_get_keys", aes.test_util))
     self.set_keys = aes.AesRoundKeysFunc(("aes_set_keys", aes.test_util))
     #test values
     key, text, cypher = (
         "000102030405060708090a0b0c0d0e0f1011121314151617",
         "00112233445566778899aabbccddeeff",
         "dda97ca4864cdfe06eaf70a0ec0d7191")
     encryption_keys = (
         "000102030405060708090a0b0c0d0e0f",
         "10111213141516175846f2f95c43f4fe",
         "544afef55847f0fa4856e2e95c43f4fe",
         "40f949b31cbabd4d48f043b810b7b342",
         "58e151ab04a2a5557effb5416245080c",
         "2ab54bb43a02f8f662e3a95d66410c08",
         "f501857297448d7ebdf1c6ca87f33e3c",
         "e510976183519b6934157c9ea351f1e0",
         "1ea0372a995309167c439e77ff12051e",
         "dd7e0e887e2fff68608fc842f9dcc154",
         "859f5f237a8d5a3dc0c02952beefd63a",
         "de601e7827bcdf2ca223800fd8aeda32",
         "a4970a331a78dc09c418c271e3a41d5d")
     decryption_keys = (
         "000102030405060708090a0b0c0d0e0f",
         "1a1f181d1e1b1c194742c7d74949cbde",
         "4b4ecbdb4d4dcfda5752d7c74949cbde",
         "60dcef10299524ce62dbef152f9620cf",
         "78c4f708318d3cd69655b701bfc093cf",
         "dd1b7cdaf28d5c158a49ab1dbbc497cb",
         "c6deb0ab791e2364a4055fbe568803ab",
         "dcc1a8b667053f7dcc5c194ab5423a2e",
         "1147659047cf663b9b0ece8dfc0bf1f0",
         "f77d6ec1423f54ef5378317f14b75744",
         "8fb999c973b26839c7f9d89d85c68c72",
         "d6bebd0dc209ea494db073803e021bb9",
         "a4970a331a78dc09c418c271e3a41d5d")
     self.key = aes.AesKey(*aes.hex_to_val(key))
     self.text, self.cypher = map(aes.hex_to_block, (text, cypher))
     self.encrypt_round_keys, self.decrypt_round_keys = (
         aes.AesRoundKeys(*aes.hex_list_to_block_list(encryption_keys)),
         aes.AesRoundKeys(*aes.hex_list_to_block_list(decryption_keys)))
コード例 #4
0
 def setUp(self):
     #routines signatures
     self.set_encrypt_keys = aes.AesKeyFunc(
         ("aes192_set_encrypt_keys", aes.aes192))
     self.set_decrypt_keys = aes.AesKeyFunc(
         ("aes192_set_decrypt_keys", aes.aes192))
     self.encrypt_block = aes.AesBlockFunc(
         ("aes192_encrypt_block", aes.aes192))
     self.decrypt_block = aes.AesBlockFunc(
         ("aes192_decrypt_block", aes.aes192))
     self.get_keys = aes.AesRoundKeysFunc(
         ("aes192_get_keys", aes.test_util))
     self.set_keys = aes.AesRoundKeysFunc(("aes_set_keys", aes.test_util))
     #test values
     key, text, cypher = (
         "000102030405060708090a0b0c0d0e0f1011121314151617",
         "00112233445566778899aabbccddeeff",
         "dda97ca4864cdfe06eaf70a0ec0d7191")
     encryption_keys = ("000102030405060708090a0b0c0d0e0f",
                        "10111213141516175846f2f95c43f4fe",
                        "544afef55847f0fa4856e2e95c43f4fe",
                        "40f949b31cbabd4d48f043b810b7b342",
                        "58e151ab04a2a5557effb5416245080c",
                        "2ab54bb43a02f8f662e3a95d66410c08",
                        "f501857297448d7ebdf1c6ca87f33e3c",
                        "e510976183519b6934157c9ea351f1e0",
                        "1ea0372a995309167c439e77ff12051e",
                        "dd7e0e887e2fff68608fc842f9dcc154",
                        "859f5f237a8d5a3dc0c02952beefd63a",
                        "de601e7827bcdf2ca223800fd8aeda32",
                        "a4970a331a78dc09c418c271e3a41d5d")
     decryption_keys = ("000102030405060708090a0b0c0d0e0f",
                        "1a1f181d1e1b1c194742c7d74949cbde",
                        "4b4ecbdb4d4dcfda5752d7c74949cbde",
                        "60dcef10299524ce62dbef152f9620cf",
                        "78c4f708318d3cd69655b701bfc093cf",
                        "dd1b7cdaf28d5c158a49ab1dbbc497cb",
                        "c6deb0ab791e2364a4055fbe568803ab",
                        "dcc1a8b667053f7dcc5c194ab5423a2e",
                        "1147659047cf663b9b0ece8dfc0bf1f0",
                        "f77d6ec1423f54ef5378317f14b75744",
                        "8fb999c973b26839c7f9d89d85c68c72",
                        "d6bebd0dc209ea494db073803e021bb9",
                        "a4970a331a78dc09c418c271e3a41d5d")
     self.key = aes.AesKey(*aes.hex_to_val(key))
     self.text, self.cypher = map(aes.hex_to_block, (text, cypher))
     self.encrypt_round_keys, self.decrypt_round_keys = (
         aes.AesRoundKeys(*aes.hex_list_to_block_list(encryption_keys)),
         aes.AesRoundKeys(*aes.hex_list_to_block_list(decryption_keys)))
コード例 #5
0
ファイル: aes128.py プロジェクト: pascalbertrand/aes
 def setUp(self):
     #routines signatures
     self.set_encrypt_keys = aes.AesKeyFunc(("aes128_set_encrypt_keys",
                                             aes.aes128))
     self.set_decrypt_keys = aes.AesKeyFunc(("aes128_set_decrypt_keys",
                                             aes.aes128))
     self.encrypt_block = aes.AesBlockFunc(("aes128_encrypt_block",
                                             aes.aes128))
     self.decrypt_block = aes.AesBlockFunc(("aes128_decrypt_block",
                                             aes.aes128))
     self.get_keys = aes.AesRoundKeysFunc(("aes128_get_keys", aes.test_util))
     self.set_keys = aes.AesRoundKeysFunc(("aes_set_keys", aes.test_util))
     #test values
     key, text, cypher = (
         "000102030405060708090a0b0c0d0e0f",
         "00112233445566778899aabbccddeeff",
         "69c4e0d86a7b0430d8cdb78070b4c55a")
     encryption_keys = (
         "000102030405060708090a0b0c0d0e0f",
         "d6aa74fdd2af72fadaa678f1d6ab76fe",
         "b692cf0b643dbdf1be9bc5006830b3fe",
         "b6ff744ed2c2c9bf6c590cbf0469bf41",
         "47f7f7bc95353e03f96c32bcfd058dfd",
         "3caaa3e8a99f9deb50f3af57adf622aa",
         "5e390f7df7a69296a7553dc10aa31f6b",
         "14f9701ae35fe28c440adf4d4ea9c026",
         "47438735a41c65b9e016baf4aebf7ad2",
         "549932d1f08557681093ed9cbe2c974e",
         "13111d7fe3944a17f307a78b4d2b30c5")
     decryption_keys = (
         "000102030405060708090a0b0c0d0e0f",
         "8c56dff0825dd3f9805ad3fc8659d7fd",
         "a0db02992286d160a2dc029c2485d561",
         "c7c6e391e54032f1479c306d6319e50c",
         "a8a2f5044de2c7f50a7ef79869671294",
         "2ec410276326d7d26958204a003f32de",
         "72e3098d11c5de5f789dfe1578a2cccb",
         "8d82fc749c47222be4dadc3e9c7810f5",
         "1362a4638f2586486bff5a76f7874a83",
         "13aa29be9c8faff6f770f58000f7bf03",
         "13111d7fe3944a17f307a78b4d2b30c5")
     self.key = aes.AesKey(*aes.hex_to_val(key))
     self.text, self.cypher = map(aes.hex_to_block, (text, cypher))
     self.encrypt_round_keys, self.decrypt_round_keys = (
         aes.AesRoundKeys(*aes.hex_list_to_block_list(encryption_keys)),
         aes.AesRoundKeys(*aes.hex_list_to_block_list(decryption_keys)))
コード例 #6
0
 def setUp(self):
     #routines signatures
     self.set_encrypt_keys = aes.AesKeyFunc(
         ("aes128_set_encrypt_keys", aes.aes128))
     self.set_decrypt_keys = aes.AesKeyFunc(
         ("aes128_set_decrypt_keys", aes.aes128))
     self.encrypt_block = aes.AesBlockFunc(
         ("aes128_encrypt_block", aes.aes128))
     self.decrypt_block = aes.AesBlockFunc(
         ("aes128_decrypt_block", aes.aes128))
     self.get_keys = aes.AesRoundKeysFunc(
         ("aes128_get_keys", aes.test_util))
     self.set_keys = aes.AesRoundKeysFunc(("aes_set_keys", aes.test_util))
     #test values
     key, text, cypher = ("000102030405060708090a0b0c0d0e0f",
                          "00112233445566778899aabbccddeeff",
                          "69c4e0d86a7b0430d8cdb78070b4c55a")
     encryption_keys = ("000102030405060708090a0b0c0d0e0f",
                        "d6aa74fdd2af72fadaa678f1d6ab76fe",
                        "b692cf0b643dbdf1be9bc5006830b3fe",
                        "b6ff744ed2c2c9bf6c590cbf0469bf41",
                        "47f7f7bc95353e03f96c32bcfd058dfd",
                        "3caaa3e8a99f9deb50f3af57adf622aa",
                        "5e390f7df7a69296a7553dc10aa31f6b",
                        "14f9701ae35fe28c440adf4d4ea9c026",
                        "47438735a41c65b9e016baf4aebf7ad2",
                        "549932d1f08557681093ed9cbe2c974e",
                        "13111d7fe3944a17f307a78b4d2b30c5")
     decryption_keys = ("000102030405060708090a0b0c0d0e0f",
                        "8c56dff0825dd3f9805ad3fc8659d7fd",
                        "a0db02992286d160a2dc029c2485d561",
                        "c7c6e391e54032f1479c306d6319e50c",
                        "a8a2f5044de2c7f50a7ef79869671294",
                        "2ec410276326d7d26958204a003f32de",
                        "72e3098d11c5de5f789dfe1578a2cccb",
                        "8d82fc749c47222be4dadc3e9c7810f5",
                        "1362a4638f2586486bff5a76f7874a83",
                        "13aa29be9c8faff6f770f58000f7bf03",
                        "13111d7fe3944a17f307a78b4d2b30c5")
     self.key = aes.AesKey(*aes.hex_to_val(key))
     self.text, self.cypher = map(aes.hex_to_block, (text, cypher))
     self.encrypt_round_keys, self.decrypt_round_keys = (
         aes.AesRoundKeys(*aes.hex_list_to_block_list(encryption_keys)),
         aes.AesRoundKeys(*aes.hex_list_to_block_list(decryption_keys)))