From 2311d983a4521d2242fc2806dbbe57fc923f6b86 Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Mon, 25 Sep 2023 10:20:33 +0800 Subject: [PATCH] =?UTF-8?q?Updated=20SM3=E4=B8=AD=E7=9A=84FF2=E5=92=8CGG2?= =?UTF-8?q?=E5=87=BD=E6=95=B0=20(markdown)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SM3中的FF2和GG2函数.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SM3中的FF2和GG2函数.md b/SM3中的FF2和GG2函数.md index dab8512..68e3fb5 100644 --- a/SM3中的FF2和GG2函数.md +++ b/SM3中的FF2和GG2函数.md @@ -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)),有些老机器不支持。