Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Whirlpool (hash function)

From Wikipedia, the free encyclopedia
Cryptographic hash function
"WHIRLPOOL" redirects here. For other uses, seeWhirlpool (disambiguation).
Whirlpool
General
DesignersVincent Rijmen,Paulo S. L. M. Barreto
First published2000, 2001, 2003
Derived fromSquare,AES
CertificationNESSIE
Detail
Digest sizes512 bits
Security claimsLarge hashsum size
StructureMiyaguchi-Preneel
Rounds10
Best publiccryptanalysis
In 2009, arebound attack was announced that presents full collisions against 4.5 rounds of Whirlpool in 2120 operations, semi-free-start collisions against 5.5 rounds in 2120 time and semi-free-start near-collisions against 7.5 rounds in 2128 time.[1]

Incomputer science andcryptography,Whirlpool (sometimes styledWHIRLPOOL) is acryptographic hash function. It was designed byVincent Rijmen (co-creator of theAdvanced Encryption Standard) andPaulo S. L. M. Barreto, who first described it in 2000. It is named after theWhirlpool galaxy inCanes Venatici (M51, orNGC 5194), the first one recognized to have a spiral structure byWilliam Parsons, third Earl of Rosse, in April 1845[1].

The hash has been recommended by theNESSIE project. It has also been adopted by theInternational Organization for Standardization (ISO) and theInternational Electrotechnical Commission (IEC) as part of the joint ISO/IEC 10118-3international standard.

Design features

[edit]
TheWhirlpool Galaxy (M51), which inspired the name of the algorithm.[2]

Whirlpool is a hash designed after theSquareblock cipher, and is considered to be in that family of block cipher functions.

Whirlpool is aMiyaguchi–Preneel construction based on a substantially modifiedAdvanced Encryption Standard (AES).

Whirlpool takes a message of any length less than 2256 bits and returns a 512-bitmessage digest.[3]

The authors have declared that

"WHIRLPOOL is not (and will never be)patented. It may be used free of charge for any purpose."[2]

Version changes

[edit]

The original Whirlpool will be calledWhirlpool-0, the first revision of Whirlpool will be calledWhirlpool-T and the latest version will be calledWhirlpool in the following test vectors.

  • In the first revision in 2001, theS-box was changed from a randomly generated one with good cryptographic properties to one which has better cryptographic properties and is easier to implement in hardware.
  • In the second revision (2003), a flaw in thediffusion matrix was found that lowered the estimated security of the algorithm below its potential.[4] Changing the 8x8 rotating matrix constants from (1, 1, 3, 1, 5, 8, 9, 5) to (1, 1, 4, 1, 8, 5, 2, 9) solved this issue.

Internal structure

[edit]

The Whirlpool hash function is aMerkle–Damgård construction based on anAES-likeblock cipher W inMiyaguchi–Preneel mode.[2]

Theblock cipherW{\displaystyle W} consists of an 8×8 state matrixS{\displaystyle S} of bytes, for a total of 512 bits.

The encryption process consists of updating the state with four round functions over 10 rounds. The four round functions are SubBytes (SB orγ{\displaystyle \gamma }), ShiftColumns (SC orπ{\displaystyle \pi }), MixRows (MR orθ{\displaystyle \theta }) and AddRoundKey (AK orσ[k]{\displaystyle \sigma [k]}). During each round the new state is computed asS:=(AKMRSCSB)(S){\displaystyle S:=\left(AK\circ MR\circ SC\circ SB\right)(S)}.

SubBytes

[edit]

TheSubBytes operation applies a non-linear permutation (the S-box) to each byte of the state independently. The 8-bit S-box is composed of 3 smaller 4-bit S-boxes.

ShiftColumns

[edit]

TheShiftColumns operation cyclically shifts each byte in each column of the state. Columnj has its bytes shifted downwards byj positions.

MixBytesInRows

[edit]

TheMixBytesInRows operation is a right-multiplication of each row by an 8×8matrix overGF(28){\displaystyle GF({2^{8}})}. The matrix is chosen such that thebranch number (an important property when looking at resistance todifferential cryptanalysis) is 9, which is maximal.

AddRoundKey

[edit]

TheAddRoundKey operation uses bitwisexor to add a key calculated by the key schedule to the current state. The key schedule is identical to the encryption itself, except the AddRoundKey function is replaced by anAddRoundConstant function that adds a predetermined constant in each round.

Complete process of the Whirlpool algorithm

[edit]

Here is the detailed explanation of the Whirlpoolalgorithm as described in the official release paper[1].

First, let's define thenotation used:

Whirlpool algorithm

[edit]

The messageM{\displaystyle M} that is to be hashed is firstpadded to ensure its length is a multiple of the block size (512 bits). This is done using the standardpadding scheme defined in theISO/IEC 10118-1 standard (the same used formd5,sha-2, and others):

  1. Append a '1' bit;
  2. Append as many '0' bits as needed for the length to reach a multiple of 256 (512256{\displaystyle 512-256});
  3. Append the original length of the message in bits using 256-bitbig-endian format.

Then, the padded message is divided intot{\displaystyle t} 512-bit blocksmi{\displaystyle m_{i}},1it{\displaystyle 1\leq i\leq t}.

Whirlpool iterates theMiyaguchi-Preneel hashing scheme over these blocks[sections 3.11 and 3.12][1]:

ηi=μ(mi),H0=μ(IV),Hi=W[Hi1](ηi)Hi1ηi, 1itWhirlpool(M)μ1(Ht){\displaystyle {\begin{aligned}&{\begin{aligned}\eta _{i}&=\mu \left(m_{i}\right),\\H_{0}&=\mu \left(IV\right),\\H_{i}&=W\left[H_{i-1}\right]\left(\eta _{i}\right)\oplus H_{i-1}\oplus \eta _{i},\ 1\leq i\leq t\\\end{aligned}}\\&{\text{Whirlpool}}\left(M\right)\equiv \mu ^{-1}\left(H_{t}\right)\end{aligned}}}

Where:

Cipher W

[edit]

The internal block cipher functionW[M8×8]:M8×8M8×8{\displaystyle W\left[{\mathcal {M}}_{8\times 8}\right]:{\mathcal {M}}_{8\times 8}\to {\mathcal {M}}_{8\times 8}}[section 3.9][1] operates on and returns an 8x8matrix:

W[K]=(r=R1ρ[Kr])σ[K0]{\displaystyle {\begin{aligned}W\left[K\right]=\left({\underset {1}{\overset {r=R}{\bigcirc }}}\rho \left[K_{r}\right]\right)\circ \sigma \left[K_{0}\right]\end{aligned}}}

Where:

The key schedule expands the keyKM8×8{\displaystyle K\in {\mathcal {M}}_{8\times 8}} into asequence of keysKrM8×8, 0rR{\displaystyle K_{r}\in {\mathcal {M}}_{8\times 8},\ 0\leq r\leq R}[section 3.8][1]:

K0=K,Kr=ρ[cr](Kr1), 1rR{\displaystyle {\begin{aligned}K_{0}&=K,\\K_{r}&=\rho \left[c^{r}\right]\left(K_{r-1}\right),\ 1\leq r\leq R\\\end{aligned}}}

Where:

The round constant for therth round,r>0{\displaystyle r>0}, is amatrixcrM8×8{\displaystyle c^{r}\in {\mathcal {M}}_{8\times 8}}, defined as:

c0,jr=S[8(r1)+j],0j<8ci,jr=0,1i<8,0j<8{\displaystyle {\begin{aligned}c_{0,j}^{r}&=S\left[8\left(r-1\right)+j\right],&0\leq j<8\\c_{i,j}^{r}&=0,&1\leq i<8,0\leq j<8\\\end{aligned}}}

Where:

Round function ρ

[edit]

The round functionρ[M8×8]:M8×8M8×8{\displaystyle \rho \left[{\mathcal {M}}_{8\times 8}\right]:{\mathcal {M}}_{8\times 8}\to {\mathcal {M}}_{8\times 8}}[section 3.7][1] is defined as:

ρ[k]=σ[k]θπγ(= AK  MR  SC  SB){\displaystyle {\begin{aligned}\rho \left[k\right]&=\sigma \left[k\right]\circ \theta \circ \pi \circ \gamma \\&_{\left(=\ AK\ \circ \ MR\ \circ \ SC\ \circ \ SB\right)}\\\end{aligned}}}

Where:

Non-linear layer γ (SubBytes)

[edit]

The functionγ:M8×8M8×8{\displaystyle \gamma :{\mathcal {M}}_{8\times 8}\to {\mathcal {M}}_{8\times 8}} consists of the parallel application of a non-linearsubstitutionψ:x(Byte)S[x](Byte){\displaystyle \psi :x_{\text{(Byte)}}\to S\left[x\right]_{\text{(Byte)}}} to eachbytes of the argument independently[section 3.2][1]:

γ(a)=b  bi,j=S[ai,j], 0i<8, 0j<8,{\displaystyle {\begin{aligned}\gamma \left(a\right)=b\ \Leftrightarrow \ b_{i,j}=S\left[a_{i,j}\right],\ 0\leq i<8,\ 0\leq j<8,\\\end{aligned}}}

Cyclical permutation π (ShiftColumns)

[edit]

Thepermutationπ:M8×8M8×8{\displaystyle \pi :{\mathcal {M}}_{8\times 8}\to {\mathcal {M}}_{8\times 8}} cyclically shifts each column of its argument independently, so that columnj{\displaystyle j} is shifted downwards byj{\displaystyle j} positions[section 3.3][1]:

π(a)=b  bi,j=a((ij) mod 8), j, 0i<8, 0j<8{\displaystyle {\begin{aligned}\pi \left(a\right)=b\ \Leftrightarrow \ b_{i,j}=a_{\left(\left(i-j\right)\ {\text{mod}}\ 8\right),\ j},\ 0\leq i<8,\ 0\leq j<8\\\end{aligned}}}

Diffusion layer θ (MixBytesInRows)

[edit]

The linear diffusion layerθ:M8×8M8×8{\displaystyle \theta :{\mathcal {M}}_{8\times 8}\to {\mathcal {M}}_{8\times 8}} is a linearmapping based on thecircular matrixC=cir(01(16),01(16),04(16),01(16),08(16),05(16),02(16),09(16)){\displaystyle C={\text{cir}}\left(01_{(16)},01_{(16)},04_{(16)},01_{(16)},08_{(16)},05_{(16)},02_{(16)},09_{(16)}\right)}[section 3.4][1]:

θ(a)=aC, 0i<8, 0j<8{\displaystyle {\begin{aligned}\theta \left(a\right)=a\cdot C,\ 0\leq i<8,\ 0\leq j<8\\\end{aligned}}}

Acirculant matrixCMn×n{\displaystyle C\in {\mathcal {M}}_{n\times n}} is defined as a matrix where each row is a cyclic shift of the previous row[section 2.2][1]. Formally, acirculant matrix can be represented as:

cir(a0,a1,,an1)=(a0a1a2an1an1a0a1an2an2an1a0an3a1a2a3a0), anF28, nNor simplycir(a0,a1,,an1)=c  ci,j=a(ij) mod 8, 0i<8, 0j<8, anF28, nN{\displaystyle {\begin{aligned}&{\text{cir}}(a_{0},a_{1},\ldots ,a_{n-1})={\begin{pmatrix}a_{0}&a_{1}&a_{2}&\cdots &a_{n-1}\\a_{n-1}&a_{0}&a_{1}&\cdots &a_{n-2}\\a_{n-2}&a_{n-1}&a_{0}&\cdots &a_{n-3}\\\vdots &\vdots &\vdots &\ddots &\vdots \\a_{1}&a_{2}&a_{3}&\cdots &a_{0}\\\end{pmatrix}},\ \forall a_{n}\in \mathbb {F} _{2^{8}},\ n\in \mathbb {N} \\&{\text{or simply}}\\&{\text{cir}}(a_{0},a_{1},\ldots ,a_{n-1})=c\ \Leftrightarrow \ c_{i,j}=a_{\left(i-j\right)\ {\text{mod}}\ 8},\ 0\leq i<8,\ 0\leq j<8,\ \forall a_{n}\in \mathbb {F} _{2^{8}},\ n\in \mathbb {N} \\\end{aligned}}}

For example,circulant matrixC=cir(01(16),01(16),04(16),01(16),08(16),05(16),02(16),09(16)){\displaystyle C={\text{cir}}\left(01_{(16)},01_{(16)},04_{(16)},01_{(16)},08_{(16)},05_{(16)},02_{(16)},09_{(16)}\right)} is thematrix:

C=(01(16)01(16)04(16)01(16)08(16)05(16)02(16)09(16)09(16)01(16)01(16)04(16)01(16)08(16)05(16)02(16)02(16)09(16)01(16)01(16)04(16)01(16)08(16)05(16)05(16)02(16)09(16)01(16)01(16)04(16)01(16)08(16)08(16)05(16)02(16)09(16)01(16)01(16)04(16)01(16)01(16)08(16)05(16)02(16)09(16)01(16)01(16)04(16)04(16)01(16)08(16)05(16)02(16)09(16)01(16)01(16)01(16)04(16)01(16)08(16)05(16)02(16)09(16)01(16)){\displaystyle {\begin{aligned}C={\begin{pmatrix}01_{(16)}&01_{(16)}&04_{(16)}&01_{(16)}&08_{(16)}&05_{(16)}&02_{(16)}&09_{(16)}\\09_{(16)}&01_{(16)}&01_{(16)}&04_{(16)}&01_{(16)}&08_{(16)}&05_{(16)}&02_{(16)}\\02_{(16)}&09_{(16)}&01_{(16)}&01_{(16)}&04_{(16)}&01_{(16)}&08_{(16)}&05_{(16)}\\05_{(16)}&02_{(16)}&09_{(16)}&01_{(16)}&01_{(16)}&04_{(16)}&01_{(16)}&08_{(16)}\\08_{(16)}&05_{(16)}&02_{(16)}&09_{(16)}&01_{(16)}&01_{(16)}&04_{(16)}&01_{(16)}\\01_{(16)}&08_{(16)}&05_{(16)}&02_{(16)}&09_{(16)}&01_{(16)}&01_{(16)}&04_{(16)}\\04_{(16)}&01_{(16)}&08_{(16)}&05_{(16)}&02_{(16)}&09_{(16)}&01_{(16)}&01_{(16)}\\01_{(16)}&04_{(16)}&01_{(16)}&08_{(16)}&05_{(16)}&02_{(16)}&09_{(16)}&01_{(16)}\\\end{pmatrix}}\\\end{aligned}}}

Key addition σ (AddRoundKey)

[edit]

The affine key additionσ[M8×8]:M8×8M8×8{\displaystyle \sigma \left[{\mathcal {M}}_{8\times 8}\right]:{\mathcal {M}}_{8\times 8}\to {\mathcal {M}}_{8\times 8}} consists of the bitwiseXOR of a keymatrixkK8×8{\displaystyle k\in {\mathcal {K}}_{8\times 8}}:

σ[k](a)=ak{\displaystyle {\begin{aligned}\sigma \left[k\right]\left(a\right)=a\oplus k\\\end{aligned}}}

Substitution box S (S-Box)

[edit]

The S-BoxSM16×16{\displaystyle S\in {\mathcal {M}}_{16\times 16}} is typically represented as alookup table, where each inputbyte is mapped to a corresponding outputbyte. It can be computed using optimal diffusion mapping generation techniques[section 2.4][1] but here is amatrix representation of it:S=(18(16)23(16)c6(16)e8(16)87(16)b8(16)01(16)4f(16)36(16)a6(16)d2(16)f5(16)79(16)6f(16)91(16)52(16)60(16)bc(16)9b(16)8e(16)a3(16)0c(16)7b(16)35(16)1d(16)e0(16)d7(16)c2(16)2e(16)4b(16)fe(16)57(16)15(16)77(16)37(16)e5(16)9f(16)f0(16)4a(16)da(16)58(16)c9(16)29(16)0a(16)b1(16)a0(16)6b(16)85(16)bd(16)5d(16)10(16)f4(16)cb(16)3e(16)05(16)67(16)e4(16)27(16)41(16)8b(16)a7(16)7d(16)95(16)d8(16)fb(16)ee(16)7c(16)66(16)dd(16)17(16)47(16)9e(16)ca(16)2d(16)bf(16)07(16)ad(16)5a(16)83(16)33(16)63(16)02(16)aa(16)71(16)c8(16)19(16)49(16)d9(16)f2(16)e3(16)5b(16)88(16)9a(16)26(16)32(16)b0(16)e9(16)0f(16)d5(16)80(16)be(16)cd(16)34(16)48(16)ff(16)7a(16)90(16)5f(16)20(16)68(16)1a(16)ae(16)b4(16)54(16)93(16)22(16)64(16)f1(16)73(16)12(16)40(16)08(16)c3(16)ec(16)db(16)a1(16)8d(16)3d(16)97(16)00(16)cf(16)2b(16)76(16)82(16)d6(16)1b(16)b5(16)af(16)6a(16)50(16)45(16)f3(16)30(16)ef(16)3f(16)55(16)a2(16)ea(16)65(16)ba(16)2f(16)c0(16)de(16)1c(16)fd(16)4d(16)92(16)75(16)06(16)8a(16)b2(16)e6(16)0e(16)1f(16)62(16)d4(16)a8(16)96(16)f9(16)c5(16)25(16)59(16)84(16)72(16)39(16)4c(16)5e(16)78(16)38(16)8c(16)d1(16)a5(16)e2(16)61(16)b3(16)21(16)9c(16)1e(16)43(16)c7(16)fc(16)04(16)51(16)99(16)6d(16)0d(16)fa(16)df(16)7e(16)24(16)3b(16)ab(16)ce(16)11(16)8f(16)4e(16)b7(16)eb(16)3c(16)81(16)94(16)f7(16)b9(16)13(16)2c(16)d3(16)e7(16)6e(16)c4(16)03(16)56(16)44(16)7f(16)a9(16)2a(16)bb(16)c1(16)53(16)dc(16)0b(16)9d(16)6c(16)31(16)74(16)f6(16)46(16)ac(16)89(16)14(16)e1(16)16(16)3a(16)69(16)09(16)70(16)b6(16)d0(16)ed(16)cc(16)42(16)98(16)a4(16)28(16)5c(16)f8(16)86(16)){\displaystyle {\begin{aligned}&S={\begin{pmatrix}18_{(16)}&23_{(16)}&c6_{(16)}&e8_{(16)}&87_{(16)}&b8_{(16)}&01_{(16)}&4f_{(16)}&36_{(16)}&a6_{(16)}&d2_{(16)}&f5_{(16)}&79_{(16)}&6f_{(16)}&91_{(16)}&52_{(16)}\\60_{(16)}&bc_{(16)}&9b_{(16)}&8e_{(16)}&a3_{(16)}&0c_{(16)}&7b_{(16)}&35_{(16)}&1d_{(16)}&e0_{(16)}&d7_{(16)}&c2_{(16)}&2e_{(16)}&4b_{(16)}&fe_{(16)}&57_{(16)}\\15_{(16)}&77_{(16)}&37_{(16)}&e5_{(16)}&9f_{(16)}&f0_{(16)}&4a_{(16)}&da_{(16)}&58_{(16)}&c9_{(16)}&29_{(16)}&0a_{(16)}&b1_{(16)}&a0_{(16)}&6b_{(16)}&85_{(16)}\\bd_{(16)}&5d_{(16)}&10_{(16)}&f4_{(16)}&cb_{(16)}&3e_{(16)}&05_{(16)}&67_{(16)}&e4_{(16)}&27_{(16)}&41_{(16)}&8b_{(16)}&a7_{(16)}&7d_{(16)}&95_{(16)}&d8_{(16)}\\fb_{(16)}&ee_{(16)}&7c_{(16)}&66_{(16)}&dd_{(16)}&17_{(16)}&47_{(16)}&9e_{(16)}&ca_{(16)}&2d_{(16)}&bf_{(16)}&07_{(16)}&ad_{(16)}&5a_{(16)}&83_{(16)}&33_{(16)}\\63_{(16)}&02_{(16)}&aa_{(16)}&71_{(16)}&c8_{(16)}&19_{(16)}&49_{(16)}&d9_{(16)}&f2_{(16)}&e3_{(16)}&5b_{(16)}&88_{(16)}&9a_{(16)}&26_{(16)}&32_{(16)}&b0_{(16)}\\e9_{(16)}&0f_{(16)}&d5_{(16)}&80_{(16)}&be_{(16)}&cd_{(16)}&34_{(16)}&48_{(16)}&ff_{(16)}&7a_{(16)}&90_{(16)}&5f_{(16)}&20_{(16)}&68_{(16)}&1a_{(16)}&ae_{(16)}\\b4_{(16)}&54_{(16)}&93_{(16)}&22_{(16)}&64_{(16)}&f1_{(16)}&73_{(16)}&12_{(16)}&40_{(16)}&08_{(16)}&c3_{(16)}&ec_{(16)}&db_{(16)}&a1_{(16)}&8d_{(16)}&3d_{(16)}\\97_{(16)}&00_{(16)}&cf_{(16)}&2b_{(16)}&76_{(16)}&82_{(16)}&d6_{(16)}&1b_{(16)}&b5_{(16)}&af_{(16)}&6a_{(16)}&50_{(16)}&45_{(16)}&f3_{(16)}&30_{(16)}&ef_{(16)}\\3f_{(16)}&55_{(16)}&a2_{(16)}&ea_{(16)}&65_{(16)}&ba_{(16)}&2f_{(16)}&c0_{(16)}&de_{(16)}&1c_{(16)}&fd_{(16)}&4d_{(16)}&92_{(16)}&75_{(16)}&06_{(16)}&8a_{(16)}\\b2_{(16)}&e6_{(16)}&0e_{(16)}&1f_{(16)}&62_{(16)}&d4_{(16)}&a8_{(16)}&96_{(16)}&f9_{(16)}&c5_{(16)}&25_{(16)}&59_{(16)}&84_{(16)}&72_{(16)}&39_{(16)}&4c_{(16)}\\5e_{(16)}&78_{(16)}&38_{(16)}&8c_{(16)}&d1_{(16)}&a5_{(16)}&e2_{(16)}&61_{(16)}&b3_{(16)}&21_{(16)}&9c_{(16)}&1e_{(16)}&43_{(16)}&c7_{(16)}&fc_{(16)}&04_{(16)}\\51_{(16)}&99_{(16)}&6d_{(16)}&0d_{(16)}&fa_{(16)}&df_{(16)}&7e_{(16)}&24_{(16)}&3b_{(16)}&ab_{(16)}&ce_{(16)}&11_{(16)}&8f_{(16)}&4e_{(16)}&b7_{(16)}&eb_{(16)}\\3c_{(16)}&81_{(16)}&94_{(16)}&f7_{(16)}&b9_{(16)}&13_{(16)}&2c_{(16)}&d3_{(16)}&e7_{(16)}&6e_{(16)}&c4_{(16)}&03_{(16)}&56_{(16)}&44_{(16)}&7f_{(16)}&a9_{(16)}\\2a_{(16)}&bb_{(16)}&c1_{(16)}&53_{(16)}&dc_{(16)}&0b_{(16)}&9d_{(16)}&6c_{(16)}&31_{(16)}&74_{(16)}&f6_{(16)}&46_{(16)}&ac_{(16)}&89_{(16)}&14_{(16)}&e1_{(16)}\\16_{(16)}&3a_{(16)}&69_{(16)}&09_{(16)}&70_{(16)}&b6_{(16)}&d0_{(16)}&ed_{(16)}&cc_{(16)}&42_{(16)}&98_{(16)}&a4_{(16)}&28_{(16)}&5c_{(16)}&f8_{(16)}&86_{(16)}\\\end{pmatrix}}\\\end{aligned}}}

Whirlpool hashes

[edit]

The Whirlpool algorithm has undergone two revisions since its original 2000 specification.

People incorporating Whirlpool will most likely use the most recent revision of Whirlpool; while there are no known security weaknesses in earlier versions of Whirlpool, the most recent revision has better hardware implementation efficiency characteristics, and is also likely to be more secure. As mentioned earlier, it is also the version adopted in the ISO/IEC 10118-3international standard.

The 512-bit (64-byte) Whirlpool hashes (also termedmessage digests) are typically represented as 128-digithexadecimal numbers.
The following demonstrates a 43-byteASCII input (not including quotes) and the corresponding Whirlpool hashes:

VersionInput StringComputed Hash
Whirlpool-0"The quick brown fox jumps over the lazy dog"
 4F8F5CB531E3D49A61CF417CD133792CCFA501FD8DA53EE368FED20E5FE0248C 3A0B64F98A6533CEE1DA614C3A8DDEC791FF05FEE6D971D57C1348320F4EB42D
Whirlpool-T"The quick brown fox jumps over the lazy dog"
 3CCF8252D8BBB258460D9AA999C06EE38E67CB546CFFCF48E91F700F6FC7C183 AC8CC3D3096DD30A35B01F4620A1E3A20D79CD5168544D9E1B7CDF49970E87F1
Whirlpool"The quick brown fox jumps over the lazy dog"
 B97DE512E91E3828B40D2B0FDCE9CEB3C4A71F9BEA8D88E75C4FA854DF36725F D2B52EB6544EDCACD6F8BEDDFEA403CB55AE31F03AD62A5EF54E42EE82C3FB35

Implementations

[edit]

The authors providereference implementations of the Whirlpool algorithm, including a version written inC and a version written inJava.[2] These reference implementations have been released into the public domain.[2]

Research on the security analysis of the Whirlpool function however, has revealed that on average, the introduction of 8 random faults is sufficient to compromise the 512-bit Whirlpool hash message being processed and the secret key of HMAC-Whirlpool within the context of Cloud of Things (CoTs). This emphasizes the need for increased security measures in its implementation.[5]

Pseudo-code

[edit]

Here is an implementation example of the standard Whirlpoolalgorithm:

S :=  0x18, 0x23, 0xc6, 0xe8, 0x87, 0xb8, 0x01, 0x4f, 0x36, 0xa6, 0xd2, 0xf5, 0x79, 0x6f, 0x91, 0x52, \      0x60, 0xbc, 0x9b, 0x8e, 0xa3, 0x0c, 0x7b, 0x35, 0x1d, 0xe0, 0xd7, 0xc2, 0x2e, 0x4b, 0xfe, 0x57, \      0x15, 0x77, 0x37, 0xe5, 0x9f, 0xf0, 0x4a, 0xda, 0x58, 0xc9, 0x29, 0x0a, 0xb1, 0xa0, 0x6b, 0x85, \      0xbd, 0x5d, 0x10, 0xf4, 0xcb, 0x3e, 0x05, 0x67, 0xe4, 0x27, 0x41, 0x8b, 0xa7, 0x7d, 0x95, 0xd8, \      0xfb, 0xee, 0x7c, 0x66, 0xdd, 0x17, 0x47, 0x9e, 0xca, 0x2d, 0xbf, 0x07, 0xad, 0x5a, 0x83, 0x33, \      0x63, 0x02, 0xaa, 0x71, 0xc8, 0x19, 0x49, 0xd9, 0xf2, 0xe3, 0x5b, 0x88, 0x9a, 0x26, 0x32, 0xb0, \      0xe9, 0x0f, 0xd5, 0x80, 0xbe, 0xcd, 0x34, 0x48, 0xff, 0x7a, 0x90, 0x5f, 0x20, 0x68, 0x1a, 0xae, \      0xb4, 0x54, 0x93, 0x22, 0x64, 0xf1, 0x73, 0x12, 0x40, 0x08, 0xc3, 0xec, 0xdb, 0xa1, 0x8d, 0x3d, \      0x97, 0x00, 0xcf, 0x2b, 0x76, 0x82, 0xd6, 0x1b, 0xb5, 0xaf, 0x6a, 0x50, 0x45, 0xf3, 0x30, 0xef, \      0x3f, 0x55, 0xa2, 0xea, 0x65, 0xba, 0x2f, 0xc0, 0xde, 0x1c, 0xfd, 0x4d, 0x92, 0x75, 0x06, 0x8a, \      0xb2, 0xe6, 0x0e, 0x1f, 0x62, 0xd4, 0xa8, 0x96, 0xf9, 0xc5, 0x25, 0x59, 0x84, 0x72, 0x39, 0x4c, \      0x5e, 0x78, 0x38, 0x8c, 0xd1, 0xa5, 0xe2, 0x61, 0xb3, 0x21, 0x9c, 0x1e, 0x43, 0xc7, 0xfc, 0x04, \      0x51, 0x99, 0x6d, 0x0d, 0xfa, 0xdf, 0x7e, 0x24, 0x3b, 0xab, 0xce, 0x11, 0x8f, 0x4e, 0xb7, 0xeb, \      0x3c, 0x81, 0x94, 0xf7, 0xb9, 0x13, 0x2c, 0xd3, 0xe7, 0x6e, 0xc4, 0x03, 0x56, 0x44, 0x7f, 0xa9, \      0x2a, 0xbb, 0xc1, 0x53, 0xdc, 0x0b, 0x9d, 0x6c, 0x31, 0x74, 0xf6, 0x46, 0xac, 0x89, 0x14, 0xe1, \      0x16, 0x3a, 0x69, 0x09, 0x70, 0xb6, 0xd0, 0xed, 0xcc, 0x42, 0x98, 0xa4, 0x28, 0x5c, 0xf8, 0x86C :=  0x01, 0x01, 0x04, 0x01, 0x08, 0x05, 0x02, 0x09, \      0x09, 0x01, 0x01, 0x04, 0x01, 0x08, 0x05, 0x02, \      0x02, 0x09, 0x01, 0x01, 0x04, 0x01, 0x08, 0x05, \      0x05, 0x02, 0x09, 0x01, 0x01, 0x04, 0x01, 0x08, \      0x08, 0x05, 0x02, 0x09, 0x01, 0x01, 0x04, 0x01, \      0x01, 0x08, 0x05, 0x02, 0x09, 0x01, 0x01, 0x04, \      0x04, 0x01, 0x08, 0x05, 0x02, 0x09, 0x01, 0x01, \      0x01, 0x04, 0x01, 0x08, 0x05, 0x02, 0x09, 0x01# Matrix built from initialization vectorIM := 0, 0, 0, 0, 0, 0, 0, 0, \      0, 0, 0, 0, 0, 0, 0, 0, \      0, 0, 0, 0, 0, 0, 0, 0, \      0, 0, 0, 0, 0, 0, 0, 0, \      0, 0, 0, 0, 0, 0, 0, 0, \      0, 0, 0, 0, 0, 0, 0, 0, \      0, 0, 0, 0, 0, 0, 0, 0, \      0, 0, 0, 0, 0, 0, 0, 0R :=  10func getConstantRoundMatrix(r)    cr := IM    for j from 0 to 7        cr[j] := S[8 * (r - 1) + j]    endfor    return crendfuncfunc whirlpoolRound(matrix, key)    # Apply the non-linear transformation γ    for i from 0 to 7        for j from 0 to 7            matrix[i * 8 + j] = S[matrix[i * 8 + j]]        endfor    endfor    # Apply cyclical permutation π    tmp := matrix    for i from 0 to 7        for j from 0 to 7            # '+ 8' to prevent negative indices            matrix[i * 8 + j] = tmp[((i - j + 8) % 8) * 8 + j]        endfor    endfor    matrix := tmp    # Apply linear diffusion θ    matrix := dotProduct(matrix, C)    # Apply key addition σ[key]    matrix := matrix xor key    return matrixendfuncfunc whirlpool(M)    m, t := pad(M)  # Returns (paddedMessageDividedInChunks, amountOfChunks)    H := IM    for i from 0 to t        W := m[t]        Kr := H        W := W xor H        for r from 1 to R            cr := getConstantRoundMatrix(r)            Kr := whirlpoolRound(Kr, cr)            W := whirlpoolRound(W, Kr)        endfor        H := H xor W        H := H xor m[t]    endfor    return matrixToHexString(H)endfunc

For the linear-diffusionθ{\displaystyle \theta }, amatrix multiplication is required.Galois Field arithmetic can be used to write thismultiplication algorithm:

func dotProduct(A, B)    tmp: Matrix    for i from 0 to 7        for j from 0 to 7            tmp[i * 8 + j] := 0            for k from 0 to 7                # Galois Field (2^8) multiplication                a := A[i * 8 + k];                b := B[k * 8 + j];                product := 0;                while b > 0                    if b & 1 == 1                        product := product xor a                    endif                    if a & 0x80 != 0                        a := (a << 1) xor 0x11d  # x^8 + x^4 + x^3 + x^2 + 1                    else                        a := a << 1                    endif                    b := b >> 1                endwhile                tmp[i * 8 + j] := tmp[i * 8 + j] xor product            endfor        endfor    endfor    return tmpendfunc

Here is an implementation of the 512-bit (64-bits size,big-endian)padding:

func pad(M)    original_length := len(M)  # In bytes    # 512 bits (total length) - 256 bits (size length) - 1 bit (padding bit)    #  64 bytes               -  32 bytes              - 1 byte = 31 bytes    padding := (31 - original_length) % 64    padding := (padding + 64) % 64  # Avoid negative padding    total_length := original_length + 1 + padding + 32  # In bytes    padded: Byte[total_length]    # Copy original message    for i from 0 to original_length - 1        padded[i] := M[i]    endfor    padded[original_length] := 0x80  # Append the '1' bit, then 7 '0' bits    for i from original_length + 1 to original_length + padding        padded[i] := 0x00  # Append 8 '0' bits    endfor    for i from 0 to 31        padded[total_length - 32 + i] := (original_length * 8) >> (8 * (31 - i)) & 0xff    endfor    chunk_amount := total_length / 64    divided := Byte[chunk_amount][64]    for i from 0 to chunk_amount - 1        for j from 0 to 63            divided[i][j] := padded[i * 64 + j]        endfor    endfor    return divided, chunk_amountendfunc

And here is an example of amatrix-to-string conversion:

func matrixToHexString(matrix)    HEX := "0123456789abcdef"    result: Byte[128]    for i from 0 to 63        byte := matrix[i]        result[i * 2] := HEX[byte >> 4]        result[i * 2 + 1] := HEX[byte & 0xf]    endfor    return resultendfunc

Adoption

[edit]

Two of the first widely used mainstream cryptographic programs that started using Whirlpool wereFreeOTFE, followed byTrueCrypt in 2005.[citation needed]

VeraCrypt (a fork ofTrueCrypt) included Whirlpool (the final version) as one of its supported hash algorithms.[6]

See also

[edit]

References

[edit]
  1. ^abcdefghijklFlorian Mendel1, Christian Rechberger, Martin Schläffer, Søren S. Thomsen (2009-02-24).The Rebound Attack: Cryptanalysis of Reduced Whirlpool and Grøstl(PDF). Fast Software Encryption: 16th International Workshop.{{cite conference}}: CS1 maint: multiple names: authors list (link) CS1 maint: numeric names: authors list (link)
  2. ^abcdePaulo S. L. M. Barreto (2008-11-25)."The WHIRLPOOL Hash Function". Archived fromthe original on 2017-11-29. Retrieved2018-08-09.
  3. ^Barreto, Paulo S. L. M. & Rijmen, Vincent (2003-05-24)."The WHIRLPOOL Hashing Function". Archived fromthe original(ZIP) on 2017-10-26. Retrieved2018-08-09.{{cite journal}}:Cite journal requires|journal= (help)
  4. ^Kyoji, Shibutani & Shirai, Taizo (2003-03-11)."On the diffusion matrix employed in the Whirlpool hashing function"(PDF). Retrieved2018-08-09.{{cite journal}}:Cite journal requires|journal= (help)
  5. ^Li, W., Gao, Z., Gu, D., Ge, C., Liao, L., Zhou, Z., Liu, Y., & Liu, Z. (2017). Security Analysis of the Whirlpool Hash Function in the Cloud of Things. KSII Transactions on Internet and Information Systems, 11(1), 536–551.https://doi.org/10.3837/tiis.2017.01.028
  6. ^"Whirlpool".VeraCrypt Documentation. IDRIX. Retrieved2018-08-09.

External links

[edit]
Common functions
SHA-3 finalists
Other functions
Password hashing/
key stretching functions
General purpose
key derivation functions
MAC functions
Authenticated
encryption
modes
Attacks
Design
Standardization
Utilization
General
Mathematics
1–9999
10000–19999
20000–29999
30000+
Retrieved from "https://en.wikipedia.org/w/index.php?title=Whirlpool_(hash_function)&oldid=1336636417"
Category:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp