<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=SHA-3</id>
	<title>SHA-3 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=SHA-3"/>
	<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=SHA-3&amp;action=history"/>
	<updated>2026-07-16T17:07:10Z</updated>
	<subtitle>在这个wiki上该页的修订历史</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://arolstar52-zhtest.hf.space/index.php?title=SHA-3&amp;diff=1962267&amp;oldid=prev</id>
		<title>imported&gt;Willy1018-bot：​BOTR：批量替換所有lang-xx模板為langx模板( V6.4.0.1 )</title>
		<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=SHA-3&amp;diff=1962267&amp;oldid=prev"/>
		<updated>2025-07-05T16:12:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/%E6%9C%BA%E5%99%A8%E4%BA%BA/%E4%BD%9C%E4%B8%9A%E8%AF%B7%E6%B1%82#.E8.AB.8B.E6.B1.82.E6.89.B9.E9.87.8F.E6.9B.BF.E6.8F.9B.E6.89.80.E6.9C.89lang-xx.E6.A8.A1.E6.9D.BF.E7.82.BAlangx.E6.A8.A1.E6.9D.BF&quot; class=&quot;extiw&quot; title=&quot;wikipedia:机器人/作业请求&quot;&gt;BOTR&lt;/a&gt;：批量替換所有lang-xx模板為langx模板( V6.4.0.1 )&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{noteTA&lt;br /&gt;
|G1=IT&lt;br /&gt;
}}&lt;br /&gt;
{{Infobox cryptographic hash function&lt;br /&gt;
| name           = SHA-3&amp;lt;br/&amp;gt;(Keccak)&lt;br /&gt;
| image          =&lt;br /&gt;
| caption        =&lt;br /&gt;
&amp;lt;!-- General --&amp;gt;&lt;br /&gt;
| designers      = Guido Bertoni, [[Joan Daemen]], Michaël Peeters, and [[Gilles Van Assche]].&lt;br /&gt;
| publish date = 2015&lt;br /&gt;
| series         = ([[SHA-0]]), [[SHA-1]], [[SHA-2]], SHA-3&lt;br /&gt;
| derived from   =&lt;br /&gt;
| derived to     =&lt;br /&gt;
| related to     =&lt;br /&gt;
| certification  = [[Federal Information Processing Standard|FIPS]] PUB 202&lt;br /&gt;
&amp;lt;!-- Detail --&amp;gt;&lt;br /&gt;
| digest size    = 任意&lt;br /&gt;
| structure      = [[海绵函数]]&lt;br /&gt;
| speed          =在x86-64微架构的計算機上，Keccak-f [1600]加上XORing 1024位的效率大約為12.6位元每时钟周期&amp;lt;ref name=&amp;quot;ksoftimpl&amp;quot;&amp;gt;[http://keccak.noekeon.org/Keccak-implementation-3.2.pdf Keccak implementation overview Version 3.2] {{Wayback|url=http://keccak.noekeon.org/Keccak-implementation-3.2.pdf |date=20131014172014 }}, section 3.1&amp;lt;/ref&amp;gt;，接近于SHA2-256&lt;br /&gt;
| cryptanalysis  = 對Keccak-512的原像攻擊減少到8回合，需要&amp;lt;math&amp;gt;2^{511.5}&amp;lt;/math&amp;gt;的時間复杂度和&amp;lt;math&amp;gt;2^{508}&amp;lt;/math&amp;gt;的内存&amp;lt;ref&amp;gt;{{cite journal |last1=Morawiecki |first1=Paweł |last2=Pieprzyk |first2=Josef |last3=Srebrny |first3=Marian |editor1-last=Moriai |editor1-first=S |title=Rotational Cryptanalysis of Round-Reduced Keccak |journal=Fast Software Encryption Lecture Notes in Computer Science |date=2013 |volume=8424 |pages=241–262 |doi=10.1007/978-3-662-43933-3_13 |url=https://eprint.iacr.org/2012/546.pdf |language=en |archive-url=https://web.archive.org/web/20130108011253/https://eprint.iacr.org/2012/546.pdf |archive-date=2013-01-08 |access-date=2019-02-08 |df= |series=Lecture Notes in Computer Science |isbn=978-3-662-43932-6 |dead-url=no }}&amp;lt;/ref&amp;gt;。完整的24回合Keccak-f [1600]存在零和識別符，儘管它們不能用於攻擊散列函數本身&amp;lt;ref&amp;gt;{{cite web |url=http://keccak.noekeon.org/Keccak-submission-3.pdf |title=The Keccak SHA-3 submission |last1=Bertoni |first1=Guido |last2=Daemen |first2=Joan |last3=Peeters |first3=Michaël |last4=van Assche |first4=Giles |date=January 14, 2011 |website=keccak.noekeon.org |archive-url=https://web.archive.org/web/20110819084908/http://keccak.noekeon.org/Keccak-submission-3.pdf |archive-date=2011-08-19 |access-date=February 9, 2014 |dead-url=no }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;SHA-3&amp;#039;&amp;#039;&amp;#039;（第三代安全雜湊演算法，{{langx|en|Secure Hash Algorithm 3}}），之前名為&amp;#039;&amp;#039;&amp;#039;Keccak&amp;#039;&amp;#039;&amp;#039;（{{IPAc-en|ˈ|k|ɛ|t|ʃ|æ|k|}}或{{IPAc-en|k|ɛ|t|ʃ|ɑː|k}})）演算法，&amp;lt;ref name=&amp;quot;nist&amp;quot;&amp;gt;{{cite web|url=http://www.nist.gov/itl/csd/sha-100212.cfm|title=NIST Selects Winner of Secure Hash Algorithm (SHA-3) Competition|date=2012-10-02|publisher=[[NIST]]|accessdate=2012-10-02|archive-url=https://web.archive.org/web/20121005031201/http://www.nist.gov/itl/csd/sha-100212.cfm|archive-date=2012-10-05|dead-url=no}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web|title=The Keccak sponge function family: Specifications summary|url=http://keccak.noekeon.org/specs_summary.html|accessdate=2011-05-11|authors=Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche|archive-url=https://web.archive.org/web/20160806192717/http://keccak.noekeon.org/specs_summary.html|archive-date=2016-08-06|dead-url=no}}&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;drdobbs&amp;quot;&amp;gt;{{cite web|url=http://www.drdobbs.com/security/keccak-the-new-sha-3-encryption-standard/240154037|title=Keccak: The New SHA-3 Encryption Standard|website=Dr. Dobbs|access-date=2016-07-24|archive-url=https://web.archive.org/web/20160714153605/http://www.drdobbs.com/security/keccak-the-new-sha-3-encryption-standard/240154037|archive-date=2016-07-14|dead-url=no}}&amp;lt;/ref&amp;gt;設計者宣稱在 [[Intel Core 2]] 的CPU上面，此演算法的效能是12.6时钟周期每位元組（cycles per byte）&amp;lt;ref name=&amp;quot;ksoftimpl&amp;quot;/&amp;gt;&amp;lt;ref&amp;gt;{{Citation |title=Fair and Comprehensive Performance Evaluation of 14 Second Round SHA-3 ASIC Implementations |url=http://csrc.nist.gov/groups/ST/hash/sha-3/Round2/Aug2010/documents/papers/SCHAUMONT_SHA3.pdf |first1=Xu |last1=Guo |first2=Sinan |last2=Huang |first3=Leyla |last3=Nazhandali |first4=Patrick |last4=Schaumont |journal=NIST 2nd SHA-3 Candidate Conference |accessdate=2011-02-18 |page=12 |date=Aug  2010 |archive-url=https://web.archive.org/web/20100910145512/http://csrc.nist.gov/groups/ST/hash/sha-3/Round2/Aug2010/documents/papers/SCHAUMONT_SHA3.pdf |archive-date=2010-09-10 |dead-url=no }}Keccak is second only to Luffa, which did not advance to the final round.&amp;lt;/ref&amp;gt;。&lt;br /&gt;
&lt;br /&gt;
SHA-3 在2015年8月5日由 NIST 通过 FIPS 202 正式发表。&amp;lt;ref name=&amp;quot;nist.gov&amp;quot;&amp;gt;{{Cite web |url=http://www.nist.gov/itl/csd/201508_sha3.cfm |title=存档副本 |access-date=2015-08-18 |archive-url=https://web.archive.org/web/20150817005537/http://www.nist.gov/itl/csd/201508_sha3.cfm |archive-date=2015-08-17 |dead-url=no }}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{Cite web |url=http://www.nist.gov/manuscript-publication-search.cfm?pub_id=919061 |title=存档副本 |access-date=2015-08-18 |archive-url=https://web.archive.org/web/20150812222834/http://www.nist.gov/manuscript-publication-search.cfm?pub_id=919061 |archive-date=2015-08-12 |dead-url=no }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 历史 ==&lt;br /&gt;
* Keccak 是一個[[加密雜湊演算法]]，由 [[Guido Bertoni]]，[[Joan Daemen]]，[[Michaël Peeters]]，以及[[Gilles Van Assche]]在[[RadioGatún]]上设计。&lt;br /&gt;
* 2012年10月2日，Keccak 被選為[[NIST雜湊函式競賽]]的勝利者&amp;lt;ref&amp;gt;{{cite web |url = http://www.nist.gov/itl/csd/sha-100212.cfm |title = NIST Selects Winner of Secure Hash Algorithm (SHA-3) Competition |date = 2012-10-02 |publisher = [[NIST]] |accessdate = 2012-10-02 |archive-url = https://web.archive.org/web/20121005031201/http://www.nist.gov/itl/csd/sha-100212.cfm |archive-date = 2012-10-05 |dead-url = no }}&amp;lt;/ref&amp;gt;。SHA-2目前沒有出現明顯的弱點。由於對[[MD5]]、[[SHA-0]]和[[SHA-1]]出現成功的破解，NIST感覺需要一個與之前演算法不同的，可替換的加密雜湊演算法，也就是現在的 SHA-3。&lt;br /&gt;
* 2014年，[[NIST]] 发布了 [[FIPS]] 202 的草案 &amp;quot;SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions&amp;quot;。&amp;lt;ref&amp;gt;{{cite web | url=http://csrc.nist.gov/groups/ST/hash/sha-3/sha-3_standardization.html | title=SHA-3 standardization | publisher=NIST | accessdate=2015-04-16 | archive-url=https://web.archive.org/web/20150405120503/http://csrc.nist.gov/groups/ST/hash/sha-3/sha-3_standardization.html | archive-date=2015-04-05 | dead-url=no }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
* 2015年8月5日，FIPS 202 最终被 NIST 批准。&amp;lt;ref&amp;gt;{{cite web|url=https://federalregister.gov/a/2015-19181|title=Federal Information Processing Standards: Permutation-Based Hash and Extendable-Output Functions, etc.|date=Aug 5, 2015|accessdate=5 Aug 2015|author=National Institute of Standards and Technology}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 设计 ==&lt;br /&gt;
Keccak 使用[[海綿函數]]&amp;lt;ref&amp;gt;{{cite web |url=http://sponge.noekeon.org/ |title=Sponge Functions |publisher=Ecrypt Hash Workshop 2007 |authors=Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche |access-date=2012-10-20 |archive-url=https://www.webcitation.org/6AQLAQuz4?url=http://sponge.noekeon.org/ |archive-date=2012-09-04 |dead-url=no }}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;{{cite web |url=http://sponge.noekeon.org/ |title=On the Indifferentiability of the Sponge Construction |publisher=EuroCrypt 2008 |authors=Guido Bertoni, Joan Daemen, Michaël Peeters and Gilles Van Assche |access-date=2012-10-20 |archive-url=https://www.webcitation.org/6AQLAQuz4?url=http://sponge.noekeon.org/ |archive-date=2012-09-04 |dead-url=no }}&amp;lt;/ref&amp;gt;，此函數會將資料與初始的內部狀態做XOR運算，這是無可避免可置換的（inevitably permuted）。在最大的版本，演算法使用的內存狀態是使用一個5×5的二維陣列，資料型態是64位元的字節，總計1600位元 。縮版的演算法使用比較小的，以2為冪次的字節大小&amp;#039;&amp;#039;w&amp;#039;&amp;#039;為1位元，總計使用25位元。除了使用較小的版本來研究加密分析攻擊，比較適中的大小（例如從&amp;#039;&amp;#039;w&amp;#039;&amp;#039;=4使用100位元，到&amp;#039;&amp;#039;w&amp;#039;&amp;#039;=32使用800位元）則提供了比較實際且輕量的替代方案。&lt;br /&gt;
&lt;br /&gt;
== Keccak 的置換 ==&lt;br /&gt;
&lt;br /&gt;
置換方法是先定義[[字 (計算機)|字]]的長度為二的某次方，&amp;#039;&amp;#039;w&amp;#039;&amp;#039;&amp;amp;nbsp;=&amp;amp;nbsp;2&amp;lt;sup&amp;gt;ℓ&amp;lt;/sup&amp;gt;位元。SHA-3的主要應用使用64位元的字長，ℓ&amp;amp;nbsp;=&amp;amp;nbsp;6。&lt;br /&gt;
&lt;br /&gt;
內存狀態可以被視為5×5×&amp;#039;&amp;#039;w&amp;#039;&amp;#039;的三維陣列。令&amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;]代表內存狀態的第(&amp;#039;&amp;#039;i&amp;#039;&amp;#039;×5 + &amp;#039;&amp;#039;j&amp;#039;&amp;#039;)×&amp;#039;&amp;#039;w&amp;#039;&amp;#039; + &amp;#039;&amp;#039;k&amp;#039;&amp;#039;個位元（使用小端序，little-endian，參見[[位元組序]]）。&lt;br /&gt;
&lt;br /&gt;
置換函數是五個子段落（sub-round）作12+2ℓ次的迴圈，每一個子段落都相當簡單：&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
; &amp;#039;&amp;#039;θ&amp;#039;&amp;#039;&lt;br /&gt;
: Compute the [[Parity (mathematics)|parity]] of each of the 5&amp;#039;&amp;#039;w&amp;#039;&amp;#039; (320, when {{nowrap|1=&amp;#039;&amp;#039;w&amp;#039;&amp;#039; = 64}}) 5-bit columns, and exclusive-or that into two nearby columns in a regular pattern.  To be precise, {{nowrap|&amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;] ← &amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;] ⊕ parity(a[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;−1][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;]) ⊕ parity(a[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;+1][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;−1])}}&lt;br /&gt;
; &amp;#039;&amp;#039;ρ&amp;#039;&amp;#039;&lt;br /&gt;
: [[Circular shift|Bitwise rotate]] each of the 25 words by a different [[triangular number]] 0, 1, 3, 6, 10, 15, ....  To be precise, &amp;#039;&amp;#039;a&amp;#039;&amp;#039;[0][0] is not rotated, and for all {{nowrap|0 ≤ &amp;#039;&amp;#039;t&amp;#039;&amp;#039; &amp;lt; 24}}, &amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;] ← &amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;−(&amp;#039;&amp;#039;t&amp;#039;&amp;#039;+1)(&amp;#039;&amp;#039;t&amp;#039;&amp;#039;+2)/2], where &amp;lt;math&amp;gt;\begin{pmatrix} i \\ j \end{pmatrix} = \begin{pmatrix} 3 &amp;amp; 2 \\ 1 &amp;amp; 0 \end{pmatrix}^t \begin{pmatrix} 0 \\ 1 \end{pmatrix}&amp;lt;/math&amp;gt;.&lt;br /&gt;
; &amp;#039;&amp;#039;π&amp;#039;&amp;#039;&lt;br /&gt;
: Permute the 25 words in a fixed pattern.  {{nowrap|&amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;j&amp;#039;&amp;#039;][2&amp;#039;&amp;#039;i&amp;#039;&amp;#039;+3&amp;#039;&amp;#039;j&amp;#039;&amp;#039;] ← &amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;]}}&lt;br /&gt;
; &amp;#039;&amp;#039;χ&amp;#039;&amp;#039;&lt;br /&gt;
: Bitwise combine along rows, using {{nowrap|1=&amp;#039;&amp;#039;a&amp;#039;&amp;#039; ← &amp;#039;&amp;#039;a&amp;#039;&amp;#039; ⊕ (¬&amp;#039;&amp;#039;b&amp;#039;&amp;#039; &amp;amp;amp; &amp;#039;&amp;#039;c&amp;#039;&amp;#039;)}}.  To be precise, {{nowrap|&amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;] ← &amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;] ⊕ ¬&amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;+&amp;#039;&amp;#039;1&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;] &amp;amp;amp; &amp;#039;&amp;#039;a&amp;#039;&amp;#039;[&amp;#039;&amp;#039;i&amp;#039;&amp;#039;][&amp;#039;&amp;#039;j&amp;#039;&amp;#039;+&amp;#039;&amp;#039;2&amp;#039;&amp;#039;][&amp;#039;&amp;#039;k&amp;#039;&amp;#039;]}}.  This is the only non-linear operation in SHA-3.&lt;br /&gt;
; &amp;#039;&amp;#039;ι&amp;#039;&amp;#039;&lt;br /&gt;
: Exclusive-or a round constant into one word of the state.  To be precise, in round &amp;#039;&amp;#039;n&amp;#039;&amp;#039;, for {{nowrap|0 ≤ &amp;#039;&amp;#039;m&amp;#039;&amp;#039; ≤ ℓ}}, &amp;#039;&amp;#039;a&amp;#039;&amp;#039;[0][0][2&amp;lt;sup&amp;gt;&amp;#039;&amp;#039;m&amp;#039;&amp;#039;&amp;lt;/sup&amp;gt;−1] is exclusive-ORed with bit {{nowrap|&amp;#039;&amp;#039;m&amp;#039;&amp;#039; + 7&amp;#039;&amp;#039;n&amp;#039;&amp;#039;}} of a degree-8 [[LFSR]] sequence.  This breaks the symmetry that is preserved by the other sub-rounds.&lt;br /&gt;
&lt;br /&gt;
==Hashing variable-length messages==&lt;br /&gt;
[[Image:SpongeConstruction.svg|thumb|upright=1.35|right|alt=Illustration of the sponge construction |The sponge construction for hash functions.  &amp;#039;&amp;#039;p&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&amp;#039;&amp;#039; are input, &amp;#039;&amp;#039;z&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&amp;#039;&amp;#039; are hashed output.  The unused &amp;quot;capacity&amp;quot; &amp;#039;&amp;#039;c&amp;#039;&amp;#039; should be twice the desired resistance to [[Collision attack|collision]] or [[preimage attack]]s.]] SHA-3 uses the &amp;quot;sponge construction&amp;quot;, where input is &amp;quot;absorbed&amp;quot; into the hash state at a given rate, then an output hash is &amp;quot;squeezed&amp;quot; from it at the same rate.&lt;br /&gt;
&lt;br /&gt;
To absorb &amp;#039;&amp;#039;r&amp;#039;&amp;#039; bits of data, the data is XORed into the leading bits of the state, and the block permutation is applied.  To squeeze, the first &amp;#039;&amp;#039;r&amp;#039;&amp;#039; bits of the state are produced as output, and the block permutation is applied if additional output is desired.&lt;br /&gt;
&lt;br /&gt;
Central to this is the &amp;quot;capacity&amp;quot; of the hash function, which is the {{nowrap|1=&amp;#039;&amp;#039;c&amp;#039;&amp;#039; = 25&amp;#039;&amp;#039;w&amp;#039;&amp;#039; − &amp;#039;&amp;#039;r&amp;#039;&amp;#039;}} state bits that are not touched by input or output.  This can be adjusted based on security requirements, but the SHA-3 proposal sets a conservative {{nowrap|1=&amp;#039;&amp;#039;c&amp;#039;&amp;#039; = 2&amp;#039;&amp;#039;n&amp;#039;&amp;#039;}}, where &amp;#039;&amp;#039;n&amp;#039;&amp;#039; is the size of the output hash.  Thus &amp;#039;&amp;#039;r&amp;#039;&amp;#039;, the number of message bits processed per block permutation, depends on the output hash size. The NIST submission sets the rate &amp;#039;&amp;#039;r&amp;#039;&amp;#039; as 1152, 1088, 832, or 576 (144, 136, 104 and 72 bytes) for 224, 256, 384 and 512-bit hash sizes, respectively. In April 2014, NIST pubished a draft that confirms these values. &amp;lt;ref name=&amp;quot;draft201404&amp;quot;&amp;gt;{{cite web |url=http://csrc.nist.gov/publications/drafts/fips-202/fips_202_draft.pdf |title=SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions |publisher=NIST |author=NIST Computer Security Division (CSD)}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To ensure the message can be evenly divided into &amp;#039;&amp;#039;r&amp;#039;&amp;#039;-bit blocks, padding is required. The submission proposes the bit pattern 10&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;1: a 1 bit, zero or more 0 bits (maximum {{nowrap|&amp;#039;&amp;#039;r&amp;#039;&amp;#039; − 1}}), and a final 1 bit.  The final 1 bit is required because the sponge construction security proof requires that the rate is encoded in the final block (&amp;quot;multi rate padding&amp;quot;). The current draft includes adding bits 01 to the message before the applying the padding.&amp;lt;ref name=&amp;quot;draft201404&amp;quot;/&amp;gt; This provides domain separation from the SHAKE&amp;#039;s, the other sponge modes included in the draft. For byte granularity data, this never increases the message size, since we have six unused bits anyways.&lt;br /&gt;
&lt;br /&gt;
To compute a hash, initialize the state to 0, pad the input, and break it into &amp;#039;&amp;#039;r&amp;#039;&amp;#039;-bit pieces.  Absorb the input into the state; that is, for each piece, XOR it into the state and then apply the block permutation.&lt;br /&gt;
&lt;br /&gt;
After the final block permutation, the leading &amp;#039;&amp;#039;n&amp;#039;&amp;#039; bits of the state are the desired hash.  Because &amp;#039;&amp;#039;r&amp;#039;&amp;#039; is always greater than &amp;#039;&amp;#039;n&amp;#039;&amp;#039;, there is actually never a need for additional block permutations in the squeezing phase.  However, arbitrary output length may be useful in applications such as [[optimal asymmetric encryption padding]].  In this case, &amp;#039;&amp;#039;n&amp;#039;&amp;#039; is a security parameter rather than the output size.&lt;br /&gt;
&lt;br /&gt;
Although not part of the SHA-3 competition requirements, smaller variants of the block permutation can be used, for hash output sizes up to half their state size, if the rate r is limited appropriately.  For example, a 256-bit hash can be computed using 25 32-bit words if {{nowrap|1=&amp;#039;&amp;#039;r&amp;#039;&amp;#039; = 800 − 2×256 = 288}} (36 bytes per iteration).&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 修改 ==&lt;br /&gt;
在整個 NIST 雜湊函數比賽裡面，參賽者允許稍微修改演算法解決已經出現的問題。Keccak 的修改有：&lt;br /&gt;
* 迴圈的數目從12+ℓ變成12+2ℓ，以增加安全度。&lt;br /&gt;
* 填充函式使用比起上述10&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;1的方式更加複雜的作法。&lt;br /&gt;
* 吸收比率&amp;#039;&amp;#039;r&amp;#039;&amp;#039;增加到安全限制，而非向下捨入到最接近某個2的冪次。&lt;br /&gt;
&lt;br /&gt;
== SHA-3 範例 ==&lt;br /&gt;
* 空字串的雜湊值：&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;SHA3-224(&amp;quot;&amp;quot;)&amp;lt;/span&amp;gt;&lt;br /&gt;
 6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;SHA3-256(&amp;quot;&amp;quot;)&amp;lt;/span&amp;gt;&lt;br /&gt;
 a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;SHA3-384(&amp;quot;&amp;quot;)&amp;lt;/span&amp;gt;&lt;br /&gt;
 0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;SHA3-512(&amp;quot;&amp;quot;)&amp;lt;/span&amp;gt;&lt;br /&gt;
 a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;SHAKE128(&amp;quot;&amp;quot;, 256)&amp;lt;/span&amp;gt;&lt;br /&gt;
 7f9c2ba4e88f827d616045507605853ed73b8093f6efbc88eb1a6eacfa66ef26&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;SHAKE256(&amp;quot;&amp;quot;, 512)&amp;lt;/span&amp;gt;&lt;br /&gt;
 46b9dd2b0ba88d13233b3feb743eeb243fcd52ea62b81b82b50c27646ed5762fd75dc4ddd8c0f200cb05019d67b592f6fc821c49479ab48640292eacb3b7c4be&lt;br /&gt;
&lt;br /&gt;
* 由於[[雪崩效应]]，即使一個很小的改變都會產出幾乎完全不同的雜湊值。舉例來說，把 dog 改成 dof：&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;SHAKE128(&amp;quot;The quick brown fox jumps over the lazy dog&amp;quot;, 256)&amp;lt;/span&amp;gt;&lt;br /&gt;
 f4202e3c5852f9182a0430fd8144f0a74b95e7417ecae17db0f8cfeed0e3e66e&lt;br /&gt;
 &amp;lt;span style=&amp;quot;color: green;&amp;quot;&amp;gt;SHAKE128(&amp;quot;The quick brown fox jumps over the lazy dof&amp;quot;, 256)&amp;lt;/span&amp;gt;&lt;br /&gt;
 853f4538be0db9621a6cea659a06c1107b1f83f02b13d18297bd39d7411cf10c&lt;br /&gt;
&lt;br /&gt;
== SHA 家族函数的比较 ==&lt;br /&gt;
在下面的表格中，“内部状态”指的是传递到下一个块的位数。&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin-top: 0px;&amp;quot;&lt;br /&gt;
|+ SHA 家族函数的比较&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; | 算法及其变体&lt;br /&gt;
! 输出长度&amp;lt;br/ &amp;gt;(位)&lt;br /&gt;
! 内部状态大小&amp;lt;br/ &amp;gt;(位)&lt;br /&gt;
! 块大小&amp;lt;br/ &amp;gt;(位)&lt;br /&gt;
! 最大消息长度&amp;lt;br/ &amp;gt;(位)&lt;br /&gt;
! 循环&lt;br /&gt;
! 操作&lt;br /&gt;
! 安全性&amp;lt;br/ &amp;gt;(位)&lt;br /&gt;
! 示例的性能{{refn|在 [[AMD Opteron]] 8354 2.2 GHz 处理器上运行64位 Linux&amp;lt;ref&amp;gt;{{cite web|url=http://www.cryptopp.com/benchmarks-amd64.html|title=Crypto++ 5.6.0 Benchmarks|accessdate=2013-06-13|archive-url=https://web.archive.org/web/20161014211419/http://www.cryptopp.com/benchmarks-amd64.html|archive-date=2016-10-14|dead-url=no}}&amp;lt;/ref&amp;gt;}}&amp;lt;br/ &amp;gt;([[Mebibyte|MiB]]/s)&lt;br /&gt;
|- style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;#039;&amp;#039;&amp;#039;[[MD5]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;(作为参考) || 128 || 128&amp;lt;br&amp;gt;(4 × 32) || 512 || 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; − 1 || 64 || 按位与, 按位异或, 循环移位, 填充(求模 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;), 按位或 || {{Bad|&amp;amp;lt;18&amp;lt;br/ &amp;gt;(已发现碰撞)}} || 335&lt;br /&gt;
|- style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;#039;&amp;#039;&amp;#039;[[SHA-0]]&amp;#039;&amp;#039;&amp;#039; || 160 || 160&amp;lt;br&amp;gt;(5 × 32) || 512 || 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; − 1|| 80 || rowspan=&amp;quot;2&amp;quot; | 按位与, 按位异或, 循环移位, 填充(求模 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;),按位或 || {{Bad|&amp;amp;lt;34&amp;lt;br/ &amp;gt;(已发现碰撞)}}  || -&lt;br /&gt;
|- style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | &amp;#039;&amp;#039;&amp;#039;[[SHA-1]]&amp;#039;&amp;#039;&amp;#039; || 160 || 160&amp;lt;br&amp;gt;(5 × 32) || 512 || 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; − 1 || 80 || {{Bad|&amp;amp;lt;63&amp;lt;br/ &amp;gt;(已發現碰撞&amp;lt;ref&amp;gt;{{cite web |url=https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html |title=Google Security Blog - Announcing the first SHA1 collision |accessdate=2017-02-23 |archive-url=https://web.archive.org/web/20170424012912/https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html |archive-date=2017-04-24 |dead-url=no }}&amp;lt;/ref&amp;gt;}}) || 192&lt;br /&gt;
|- style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | &amp;#039;&amp;#039;&amp;#039;[[SHA-2]]&amp;#039;&amp;#039;&amp;#039; || &amp;#039;&amp;#039;SHA-224&amp;#039;&amp;#039; &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;SHA-256&amp;#039;&amp;#039; || 224&amp;lt;br/&amp;gt;256 || 256&amp;lt;br&amp;gt;(8 × 32) || 512 || 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt; − 1 || 64 || 按位与, 按位异或, 循环移位, 填充(求模 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;), 按位或, 移位 || {{Yes}}&amp;lt;br /&amp;gt;112/128 || 139&lt;br /&gt;
|- style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
| &amp;#039;&amp;#039;SHA-384&amp;#039;&amp;#039; &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;SHA-512&amp;#039;&amp;#039; &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;SHA-512/224&amp;#039;&amp;#039; &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;SHA-512/256&amp;#039;&amp;#039; ||  384 &amp;lt;br/&amp;gt; 512 &amp;lt;br/&amp;gt; 224 &amp;lt;br/&amp;gt; 256 || 512&amp;lt;br&amp;gt;(8 × 64) || 1024 || 2&amp;lt;sup&amp;gt;128&amp;lt;/sup&amp;gt; − 1 || 80 || 按位与, 按位异或, 循环移位, 填充(求模 2&amp;lt;sup&amp;gt;64&amp;lt;/sup&amp;gt;), 按位或, 移位 || {{Yes}}&amp;lt;br /&amp;gt;192/256/112/128 || 154&lt;br /&gt;
|- style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | &amp;#039;&amp;#039;&amp;#039;SHA-3&amp;#039;&amp;#039;&amp;#039; || &amp;#039;&amp;#039;SHA3-224&amp;#039;&amp;#039; &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;SHA3-256&amp;#039;&amp;#039; &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;SHA3-384&amp;#039;&amp;#039; &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;SHA3-512&amp;#039;&amp;#039; || 224 &amp;lt;br/&amp;gt; 256 &amp;lt;br/&amp;gt; 384 &amp;lt;br/&amp;gt; 512 || rowspan=&amp;quot;2&amp;quot; | 1600&amp;lt;br&amp;gt;(5 × 5 × 64) || 1152 &amp;lt;br/&amp;gt; 1088 &amp;lt;br/&amp;gt; 832 &amp;lt;br/&amp;gt; 576 || rowspan=&amp;quot;2&amp;quot; | 无限制 || rowspan=&amp;quot;2&amp;quot; | 24 || rowspan=&amp;quot;2&amp;quot; | 按位与, 按位异或, 循环移位, 取反 || {{Yes}}&amp;lt;br /&amp;gt;112/128/192/256 || -&lt;br /&gt;
|- style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
| &amp;#039;&amp;#039;SHAKE128&amp;#039;&amp;#039; &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;SHAKE256&amp;#039;&amp;#039; || &amp;#039;&amp;#039;d&amp;#039;&amp;#039; (可变长) &amp;lt;br/&amp;gt; &amp;#039;&amp;#039;d&amp;#039;&amp;#039; (可变长) || 1344 &amp;lt;br/&amp;gt; 1088 || {{Yes}}&amp;lt;br /&amp;gt;min (&amp;#039;&amp;#039;d&amp;#039;&amp;#039;/2, 128)&amp;lt;br/&amp;gt;min (&amp;#039;&amp;#039;d&amp;#039;&amp;#039;/2, 256) || -&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== 參考資料 ==&lt;br /&gt;
{{reflist|2}}&lt;br /&gt;
&lt;br /&gt;
== 外部連結 ==&lt;br /&gt;
* [https://keccak.team/ Keccak網站(英文)]{{Wayback|url=https://keccak.team/ |date=202506012355 }}&lt;br /&gt;
* [https://github.com/gvanas/KeccakCodePackage Keccak官方C语言代码包]{{Wayback|url=https://github.com/gvanas/KeccakCodePackage |date=20141013191624 }}&lt;br /&gt;
* [https://github.com/gvanas/KeccakTools Keccak官方C++语言工具集]{{Wayback|url=https://github.com/gvanas/KeccakTools |date=20141013191724 }}&lt;br /&gt;
* [https://github.com/kocakosm/pitaya/blob/master/src/org/kocakosm/pitaya/security/Keccak.java A Java implementation of Keccak]&lt;br /&gt;
* [https://web.archive.org/web/20130407154409/http://plaintext.crypto.lo.gy/article/495/untwisted-a-cryptol-implementation-of-keccak-part-1 A Cryptol implementation of Keccak]&lt;br /&gt;
* [http://cryptography.gmu.edu/athena/index.php?id=source_codes A VHDL source codes developed in the Cryptographic Engineering Research Group (CERG) at George Mason University]{{Wayback|url=http://cryptography.gmu.edu/athena/index.php?id=source_codes |date=20120425083429 }}&lt;br /&gt;
&lt;br /&gt;
{{密碼學|hash}}&lt;br /&gt;
&lt;br /&gt;
[[Category:密码散列函数]]&lt;br /&gt;
[[Category:密碼學理論]]&lt;br /&gt;
[[Category:带有源代码的公共领域软件]]&lt;br /&gt;
[[Category:NIST散列函数竞赛]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Willy1018-bot</name></author>
	</entry>
</feed>