示例#1
0
 def test_init_key_schedule_0(self):
     ntk='2b7e151628aed2a6abf7158809cf4f3c'
     q = aes.init_key_schedule(aes.key_bv(ntk))
     self.assertEqual(len(q),44,"there should be 44 elements in the key schedule")
     self.assertEqual(aes.bv_hex_str(q[0]),'2b7e1516',"random testing elements\
     of key schedule according to FIPS-197 appendix 2")
     self.assertEqual(aes.bv_hex_str(q[20]),'d4d1c6f8',"random testing elements\
     of key schedule according to FIPS-197 appendix 2")
     self.assertEqual(aes.bv_hex_str(q[43]),'b6630ca6',"random testing elements\
     of key schedule according to FIPS-197 appendix 2")
     self.assertEqual(aes.bv_hex_str(q[33]),'b58dbad2',"random testing elements\
     of key schedule according to FIPS-197 appendix 2")
示例#2
0
 def test_init_key_schedule_0(self):
     ntk = '2b7e151628aed2a6abf7158809cf4f3c'
     q = aes.init_key_schedule(aes.key_bv(ntk))
     self.assertEqual(len(q), 44,
                      "there should be 44 elements in the key schedule")
     self.assertEqual(
         aes.bv_hex_str(q[0]), '2b7e1516', "random testing elements\
     of key schedule according to FIPS-197 appendix 2")
     self.assertEqual(
         aes.bv_hex_str(q[20]), 'd4d1c6f8', "random testing elements\
     of key schedule according to FIPS-197 appendix 2")
     self.assertEqual(
         aes.bv_hex_str(q[43]), 'b6630ca6', "random testing elements\
     of key schedule according to FIPS-197 appendix 2")
     self.assertEqual(
         aes.bv_hex_str(q[33]), 'b58dbad2', "random testing elements\
     of key schedule according to FIPS-197 appendix 2")
示例#3
0
 def test_sbox_lookup_2(self):
     bv = aes.key_bv("d8")
     self.assertEqual(aes.bv_hex_str(aes.sbox_lookup(bv)),'61',\
                      "testing 'd8' on sbox_lookup")
示例#4
0
 def test_inv_sbox_lookup_0(self):
     bv = aes.key_bv("61")
     self.assertEqual(aes.bv_hex_str(aes.inv_sbox_lookup(bv)),'d8',\
                      "testing '61' on inv_sbox_lookup")
示例#5
0
 def test_gv_mult_2(self):
     bv_2 = aes.key_bv("e0")
     self.assertEqual(aes.bv_hex_str(aes.gf_mult(bv_2,3)),'3b',\
                      "testing gf_mult with e0 * 3 = 3b")
示例#6
0
 def test_shift_bytes_right_2(self):
     bv = aes.key_bv("1234abcd")
     self.assertEqual(aes.bv_hex_str(aes.shift_bytes_right(bv, 1)),
                      'cd1234ab')
示例#7
0
 def test_inv_sbox_lookup_3(self):
     bv = aes.key_bv("33")
     self.assertEqual(aes.bv_hex_str(aes.inv_sbox_lookup(bv)),'66',\
                      "testing '33' on inv_sbox_lookup")
示例#8
0
 def test_inv_sbox_lookup_1(self):
     bv = aes.key_bv("d0")
     self.assertEqual(aes.bv_hex_str(aes.inv_sbox_lookup(bv)),'60',\
                      "testing 'd0' on inv_sbox_lookup")
示例#9
0
 def test_gv_mult_2(self):
     bv_2 = aes.key_bv("e0")
     self.assertEqual(aes.bv_hex_str(aes.gf_mult(bv_2,3)),'3b',\
                      "testing gf_mult with e0 * 3 = 3b")
示例#10
0
 def test_gv_mult_1(self):
     bv_1 = aes.key_bv("63")        
     self.assertEqual(aes.bv_hex_str(aes.gf_mult(bv_1,2)),'c6',\
                      "testing gf_mult with 63 * 2 = c6")
示例#11
0
 def test_shift_bytes_right_2(self):
     bv = aes.key_bv("1234abcd")
     self.assertEqual(aes.bv_hex_str(aes.shift_bytes_right(bv,1)),'cd1234ab')       
示例#12
0
 def test_shift_bytes_left_1(self):
     bv = aes.key_bv("1234abcd")
     self.assertEqual(aes.bv_hex_str(aes.shift_bytes_left(bv,2)),'abcd1234')
示例#13
0
 def test_inv_sbox_lookup_3(self):
     bv = aes.key_bv("33")
     self.assertEqual(aes.bv_hex_str(aes.inv_sbox_lookup(bv)),'66',\
                      "testing '33' on inv_sbox_lookup")
示例#14
0
 def test_inv_sbox_lookup_2(self):
     bv = aes.key_bv("62")
     self.assertEqual(aes.bv_hex_str(aes.inv_sbox_lookup(bv)),'ab',\
                      "testing '62' on inv_sbox_lookup")
示例#15
0
 def test_inv_sbox_lookup_1(self):
     bv = aes.key_bv("d0")
     self.assertEqual(aes.bv_hex_str(aes.inv_sbox_lookup(bv)),'60',\
                      "testing 'd0' on inv_sbox_lookup")    
示例#16
0
 def test_sbox_lookup_3(self):
     bv = aes.key_bv("66")
     self.assertEqual(aes.bv_hex_str(aes.sbox_lookup(bv)),'33',\
                      "testing '66' on sbox_lookup")
示例#17
0
 def test_inv_sbox_lookup_0(self):
     bv = aes.key_bv("61")
     self.assertEqual(aes.bv_hex_str(aes.inv_sbox_lookup(bv)),'d8',\
                      "testing '61' on inv_sbox_lookup")
示例#18
0
 def test_gv_mult_3(self):
     bv_1 = aes.key_bv("01")
     self.assertEqual(aes.bv_hex_str(aes.gf_mult(bv_1,1)),'01',\
                      "testing gf_mult with 63 * 2 = c6")
示例#19
0
 def test_inv_sbox_lookup_2(self):
     bv = aes.key_bv("62")
     self.assertEqual(aes.bv_hex_str(aes.inv_sbox_lookup(bv)),'ab',\
                      "testing '62' on inv_sbox_lookup")
示例#20
0
 def test_sbox_lookup_0(self):
     bv = aes.key_bv("ab")
     self.assertEqual(aes.bv_hex_str(aes.sbox_lookup(bv)),'62',\
                      "testing 'ab' on sbox_lookup")
示例#21
0
 def test_shift_bytes_left_1(self):
     bv = aes.key_bv("1234abcd")
     self.assertEqual(aes.bv_hex_str(aes.shift_bytes_left(bv, 2)),
                      'abcd1234')
示例#22
0
 def test_sbox_lookup_1(self):
     bv = aes.key_bv("60")
     self.assertEqual(aes.bv_hex_str(aes.sbox_lookup(bv)),'d0',\
                      "testing '60' on sbox_lookup")
示例#23
0
 def test_gv_mult_1(self):
     bv_1 = aes.key_bv("63")
     self.assertEqual(aes.bv_hex_str(aes.gf_mult(bv_1,2)),'c6',\
                      "testing gf_mult with 63 * 2 = c6")
示例#24
0
 def test_sbox_lookup_2(self):
     bv = aes.key_bv("d8")
     self.assertEqual(aes.bv_hex_str(aes.sbox_lookup(bv)),'61',\
                      "testing 'd8' on sbox_lookup")
示例#25
0
 def test_gv_mult_3(self):
     bv_1 = aes.key_bv("01")
     self.assertEqual(aes.bv_hex_str(aes.gf_mult(bv_1,1)),'01',\
                      "testing gf_mult with 63 * 2 = c6")
示例#26
0
 def test_sbox_lookup_1(self):
     bv = aes.key_bv("60")
     self.assertEqual(aes.bv_hex_str(aes.sbox_lookup(bv)),'d0',\
                      "testing '60' on sbox_lookup")
示例#27
0
 def test_sbox_lookup_0(self):
     bv = aes.key_bv("ab")
     self.assertEqual(aes.bv_hex_str(aes.sbox_lookup(bv)),'62',\
                      "testing 'ab' on sbox_lookup")
示例#28
0
 def test_sbox_lookup_3(self):
     bv = aes.key_bv("66")
     self.assertEqual(aes.bv_hex_str(aes.sbox_lookup(bv)),'33',\
                      "testing '66' on sbox_lookup")