SM3密码杂凑算法概要
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
SM3密码杂凑算法 SM3Cryptographic Hash Algorithm
国家密码管理局 2010年 12月
目次
1范围 ······················································································1 2术语和定义 ···············································································1 3符
号 ······················································································1 4常数与函数 ···············································································2 4.1初始
值 ················································································2 4.2常
量 ··················································································2 4.3布尔函
数 (2)
4.4置换函数 (2)
5算法描述 ·················································································2 5.1概述 ··················································································2 5.2填
充 ··················································································2 5.3迭代压
缩 ··············································································3 5.3.1迭代过
程 ·······································································3 5.3.2消息扩
展 ·······································································3 5.3.3压缩函
数 ·······································································3 5.4杂凑
值 ................................................................................4附录 A (资料性附录运算示例 ................................................................5 A.1示例1.................................................................................5 A.1示例2 (7)
SM3密码杂凑算法
1范围
本文本规定了 SM3密码杂凑算法的计算方法和计算步骤,并给出了运算示例。
本文本适用于商用密码应用中的数字签名和验证、消息认证码的生成与验证以及随机数的生成, 可满足多种密码应用的安全需求。同时,本文本还可为安全产品生产商提供产品和技术的标准定位以及标准化的参考,提高安全产品的可信性与互操作性。
2术语和定义
1.1
比特串 bit string
由 0和 1组成的二进制数字序列。
1.2
大端 big-endian
数据在内存中的一种表示格式,规定左边为高有效位,右边为低有效位。数的高阶字节放在存储器的低地址,数的低阶字节放在存储器的高地址。
1.3
消息 message
任意有限长度的比特串。本文本中消息作为杂凑算法的输入数据。
1.4
杂凑值 hash value
杂凑算法作用于消息后输出的特定长度的比特串。本文本中的杂凑值长度为256比特。
1.5
字 word
长度为 32的比特串。
3符号
下列符号适用于本文本。
ABCDEF GH :8个字寄存器或它们的值的串联B (i :第 i 个消息分组
CF :压缩函数
F F j :布尔函数,随 j 的变化取不同的表达式G
G j :布尔函数,随 j 的变化取不同的表达式
IV :初始值,用于确定压缩函数寄存器的初态P 0:压缩函数中的置换函数
P 1:消息扩展中的置换函数
T j :常量,随 j 的变化取不同的值
m :消息
m ′ :填充后的消息
mod :模运算
∧ :32比特与运算
∨ :32比特或运算
⊕ :32比特异或运算
¬:32比特非运算
+:mod 232算术加运算
≪ k :循环左移 k 比特运算
← :左向赋值运算符
4常数与函数
4.1初始值
IV =7380166f4914b2b9172442d7da8a0600a96f30bc 163138aa e38dee4d b0fb0e4e 4.2常量
T j = {
79cc 45190≤ j ≤ 15 7a 879d 8a 16≤ j ≤ 63
4.3布尔函数
F F j (X, Y, Z = {
X ⊕ Y ⊕ Z 0≤ j ≤ 15 (X∧ Y ∨ (X∧ Z ∨ (Y∧ Z 16≤ j ≤ 63
GG j (X , Y , Z = {
X ⊕ Y ⊕ Z 0≤ j ≤ 15 (X∧ Y ∨ (¬X ∧ Z 16≤ j ≤ 63
式中 X , Y , Z 为字。
4.4置换函数
P 0(X =X ⊕ (X≪ 9 ⊕ (X≪ 17