Commit 42a2e126 authored by Luc Libralesso's avatar Luc Libralesso
Browse files

add another test for AES keyschedule 128

parent 997c5110
......@@ -78,4 +78,29 @@ class TestExecAesKeySchedule < Minitest::Unit::TestCase
0x9b, 0x98, 0x98, 0xc9, 0xf9, 0xfb, 0xfb, 0xaa, 0x9b, 0x98, 0x98, 0xc9, 0xf9, 0xfb, 0xfb, 0xaa
])
end
def test_chain_aes128()
k = InputNode.new(name:"K0",dimensions:[4,4])
ks1 = AESKeyScheduleNode.new(name:"KS1", input:k.outputs[0], subtable:@sbox, rcon:1)
ks2 = AESKeyScheduleNode.new(name:"KS2", input:ks1.outputs[0], subtable:@sbox, rcon:2)
computed_outputs = compute_set_of_operators(
[0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0],
[
k.outputs[0][0][0],k.outputs[0][1][0],k.outputs[0][2][0],k.outputs[0][3][0],
k.outputs[0][0][1],k.outputs[0][1][1],k.outputs[0][2][1],k.outputs[0][3][1],
k.outputs[0][0][2],k.outputs[0][1][2],k.outputs[0][2][2],k.outputs[0][3][2],
k.outputs[0][0][3],k.outputs[0][1][3],k.outputs[0][2][3],k.outputs[0][3][3],
],
[
ks2.outputs[0][0][0],ks2.outputs[0][1][0],ks2.outputs[0][2][0],ks2.outputs[0][3][0],
ks2.outputs[0][0][1],ks2.outputs[0][1][1],ks2.outputs[0][2][1],ks2.outputs[0][3][1],
ks2.outputs[0][0][2],ks2.outputs[0][1][2],ks2.outputs[0][2][2],ks2.outputs[0][3][2],
ks2.outputs[0][0][3],ks2.outputs[0][1][3],ks2.outputs[0][2][3],ks2.outputs[0][3][3],
],
ks1.operators+ks2.operators
)
assert_equal(computed_outputs, [
0x9b, 0x98, 0x98, 0xc9, 0xf9, 0xfb, 0xfb, 0xaa, 0x9b, 0x98, 0x98, 0xc9, 0xf9, 0xfb, 0xfb, 0xaa
])
end
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment