mirror of
https://github.com/emmansun/gmsm.git
synced 2025-05-11 03:26:17 +08:00
Updated SM4 with AESENCLAST (markdown)
parent
33f6033a33
commit
f7dbb88e67
@ -62,9 +62,9 @@ sm4_box_aesbox_1
|
||||
sm4_box_aesbox_2
|
||||
for i := 0; i < 16; i++ {
|
||||
v := x.bytes[i]
|
||||
v = a1l.bytes[v&0xf] ^ a1h.bytes[v>>4]
|
||||
v = aes_sbox[v] ^ 0xf
|
||||
v = a2l.bytes[^v&0xf] ^ a2h.bytes[v>>4]
|
||||
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 = a2l.bytes[^v&0xf] ^ a2h.bytes[v>>4] // v = A2(AES-S(A1(x)))
|
||||
x.bytes[i] = v
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user