mirror of
https://github.com/emmansun/gmsm.git
synced 2025-05-10 19:16:18 +08:00
Updated SM4 with AESENCLAST (markdown)
parent
bd87ff88de
commit
62f04864fc
@ -112,7 +112,7 @@ sm4_box_aesbox_2
|
|||||||
for i := 0; i < 16; i++ {
|
for i := 0; i < 16; i++ {
|
||||||
v := x.bytes[i]
|
v := x.bytes[i]
|
||||||
v = a1l.bytes[v&0xf] ^ a1h.bytes[v>>4] // v = A1(x)
|
v = a1l.bytes[v&0xf] ^ a1h.bytes[v>>4] // v = A1(x)
|
||||||
v = aes_sbox[v] ^ 0xf // v = AES-S(A1(x)) XOR 0x0f
|
v = aes_sbox[v] ^ 0xf // v = AES-S(A1(x)) XOR 0x0f, 相当于对低四位取反。
|
||||||
v = a2l.bytes[^v&0xf] ^ a2h.bytes[v>>4] // v = A2(AES-S(A1(x)))
|
v = a2l.bytes[^v&0xf] ^ a2h.bytes[v>>4] // v = A2(AES-S(A1(x)))
|
||||||
x.bytes[i] = v
|
x.bytes[i] = v
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user