Updated SM3中的FF2和GG2函数 (markdown)

Sun Yimin 2023-09-25 10:20:33 +08:00
parent 513c49ecb5
commit 2311d983a4

@ -4,8 +4,9 @@ $GG2(X, Y, Z) = (X \land Y) \lor (\lnot X \land Z)$
# 等价公式
$FF2(X, Y, Z) = (X \land Y) \bigoplus (X \land Z) \bigoplus (Y \land Z)$
$GG2(X, Y, Z) = (Y \bigoplus Z) \land X \bigoplus Z$
$GG2(X, Y, Z) = (Y \bigoplus Z) \land X \bigoplus Z$
GG2等价公式初次见于[Intel® Integrated Performance Primitives Cryptography](https://github.com/intel/ipp-crypto)
# 应用
别是GG2其等价公式相比原来的公式因其简单具有一点点性能优势不明显也可以省一个寄存器还有就是ANDN指令属于[BMI1](https://en.wikipedia.org/wiki/X86_Bit_manipulation_instruction_set#BMI1_(Bit_Manipulation_Instruction_Set_1)),有些老机器不支持。