LSH is a cryptographic hash function designed in 2014 by South Korea to provide integrity in general-purpose software environments such as PCs and smart devices.[1] LSH is one of the cryptographic algorithms approved by the Korean Cryptographic Module Validation Program (KCMVP).And it is the national standard of South Korea (KS X 3262).
The overall structure of the hash function LSH is shown in the following figure.
The hash function LSH has the wide-pipe Merkle-Damgård structure with one-zeros padding.The message hashing process of LSH consists of the following three stages.
n
m
h\in\{0,1\}n
m
t \{sf{M}(i)
t=\lceil
\rceil
sf{CV}(0)\leftarrowsf{IV}
i=0 (t-1)
sf{CV}(i+1)\leftarrowrm{CF}(sf{CV}(i),sf{M}(i))
h\leftarrow
)
h |
The specifications of the hash function LSH are as follows.
Algorithm | Digest size in bits ( n | Number of step functions ( Ns | Chaining variable size in bits | Message block size in bits | Word size in bits ( w |
---|---|---|---|---|---|
LSH-256-224 | 224 | 26 | 512 | 1024 | 32 |
LSH-256-256 | 256 | ||||
LSH-512-224 | 224 | 28 | 1024 | 2048 | 64 |
LSH-512-256 | 256 | ||||
LSH-512-384 | 384 | ||||
LSH-512-512 | 512 |
Let
m
m
m
32wt
t=\lceil(|m|+1)/32w\rceil
\lceilx\rceil
x
Let
mp=m0\|m1\|\ldots\|m(32wt-1)
32wt
m
mp
4wt
ma=(m[0],\ldots,m[4wt-1])
m[k]=m8k\|m(8k+1)\|\ldots\|m(8k+7)
0\lek\le(4wt-1)
4wt
ma
32t
sf{M}=(M[0],\ldots,M[32t-1])
M[s]\leftarrowm[ws/8+(w/8-1)]\|\ldots\|m[ws/8+1]\|m[ws/8]
(0\les\le(32t-1))
From the word array
sf{M}
t
\{sf{M}(i)
t-1 | |
\} | |
i=0 |
sf{M}(i)\leftarrow(M[32i],M[32i+1],\ldots,M[32i+31])
(0\lei\le(t-1))
The 16-word array chaining variable
sf{CV}(0)
sf{IV}
sf{CV}(0)[l]\leftarrowsf{IV}[l]
(0\lel\le15)
The initialization vector
sf{IV}
sf{IV}[0] | sf{IV}[1] | sf{IV}[2] | sf{IV}[3] | sf{IV}[4] | sf{IV}[5] | sf{IV}[6] | sf{IV}[7] | |
---|---|---|---|---|---|---|---|---|
068608D3 | 62D8F7A7 | D76652AB | 4C600A43 | BDC40AA8 | 1ECA0B68 | DA1A89BE | 3147D354 | |
sf{IV}[8] | sf{IV}[9] | sf{IV}[10] | sf{IV}[11] | sf{IV}[12] | sf{IV}[13] | sf{IV}[14] | sf{IV}[15] | |
707EB4F9 | F65B3862 | 6B0B2ABE | 56B8EC0A | CF237286 | EE0D1727 | 33636595 | 8BB8D05F |
sf{IV}[0] | sf{IV}[1] | sf{IV}[2] | sf{IV}[3] | sf{IV}[4] | sf{IV}[5] | sf{IV}[6] | sf{IV}[7] | |
---|---|---|---|---|---|---|---|---|
46A10F1F | FDDCE486 | B41443A8 | 198E6B9D | 3304388D | B0F5A3C7 | B36061C4 | 7ADBD553 | |
sf{IV}[8] | sf{IV}[9] | sf{IV}[10] | sf{IV}[11] | sf{IV}[12] | sf{IV}[13] | sf{IV}[14] | sf{IV}[15] | |
105D5378 | 2F74DE54 | 5C2F2D95 | F2553FBE | 8051357A | 138668C8 | 47AA4484 | E01AFB41 |
sf{IV}[0] | sf{IV}[1] | sf{IV}[2] | sf{IV}[3] | |
---|---|---|---|---|
0C401E9FE8813A55 | 4A5F446268FD3D35 | FF13E452334F612A | F8227661037E354A | |
sf{IV}[4] | sf{IV}[5] | sf{IV}[6] | sf{IV}[7] | |
A5F223723C9CA29D | 95D965A11AED3979 | 01E23835B9AB02CC | 52D49CBAD5B30616 | |
sf{IV}[8] | sf{IV}[9] | sf{IV}[10] | sf{IV}[11] | |
9E5C2027773F4ED3 | 66A5C8801925B701 | 22BBC85B4C6779D9 | C13171A42C559C23 | |
sf{IV}[12] | sf{IV}[13] | sf{IV}[14] | sf{IV}[15] | |
31E2B67D25BE3813 | D522C4DEED8E4D83 | A79F5509B43FBAFE | E00D2CD88B4B6C6A |
sf{IV}[0] | sf{IV}[1] | sf{IV}[2] | sf{IV}[3] | |
---|---|---|---|---|
6DC57C33DF989423 | D8EA7F6E8342C199 | 76DF8356F8603AC4 | 40F1B44DE838223A | |
sf{IV}[4] | sf{IV}[5] | sf{IV}[6] | sf{IV}[7] | |
39FFE7CFC31484CD | 39C4326CC5281548 | 8A2FF85A346045D8 | FF202AA46DBDD61E | |
sf{IV}[8] | sf{IV}[9] | sf{IV}[10] | sf{IV}[11] | |
CF785B3CD5FCDB8B | 1F0323B64A8150BF | FF75D972F29EA355 | 2E567F30BF1CA9E1 | |
sf{IV}[12] | sf{IV}[13] | sf{IV}[14] | sf{IV}[15] | |
B596875BF8FF6DBA | FCCA39B089EF4615 | ECFF4017D020B4B6 | 7E77384C772ED802 |
sf{IV}[0] | sf{IV}[1] | sf{IV}[2] | sf{IV}[3] | |
---|---|---|---|---|
53156A66292808F6 | B2C4F362B204C2BC | B84B7213BFA05C4E | 976CEB7C1B299F73 | |
sf{IV}[4] | sf{IV}[5] | sf{IV}[6] | sf{IV}[7] | |
DF0CC63C0570AE97 | DA4441BAA486CE3F | 6559F5D9B5F2ACC2 | 22DACF19B4B52A16 | |
sf{IV}[8] | sf{IV}[9] | sf{IV}[10] | sf{IV}[11] | |
BBCDACEFDE80953A | C9891A2879725B3E | 7C9FE6330237E440 | A30BA550553F7431 | |
sf{IV}[12] | sf{IV}[13] | sf{IV}[14] | sf{IV}[15] | |
BB08043FB34E3E30 | A0DEC48D54618EAD | 150317267464BC57 | 32D1501FDE63DC93 |
sf{IV}[0] | sf{IV}[1] | sf{IV}[2] | sf{IV}[3] | |
---|---|---|---|---|
ADD50F3C7F07094E | E3F3CEE8F9418A4F | B527ECDE5B3D0AE9 | 2EF6DEC68076F501 | |
sf{IV}[4] | sf{IV}[5] | sf{IV}[6] | sf{IV}[7] | |
8CB994CAE5ACA216 | FBB9EAE4BBA48CC7 | 650A526174725FEA | 1F9A61A73F8D8085 | |
sf{IV}[8] | sf{IV}[9] | sf{IV}[10] | sf{IV}[11] | |
B6607378173B539B | 1BC99853B0C0B9ED | DF727FC19B182D47 | DBEF360CF893A457 | |
sf{IV}[12] | sf{IV}[13] | sf{IV}[14] | sf{IV}[15] | |
4981F5E570147E80 | D00C4490CA7D3E30 | 5D73940C0E4AE1EC | 894085E2EDB2D819 |
In this stage, the
t
\{sf{M}(i)
t-1 | |
\} | |
i=0 |
m
rm{CF}:l{W}16 x l{W}32 → l{W}16
i
sf{CV}(i)
i
sf{M}(i)
(i+1)
sf{CV}(i+1)
l{W}t
t
t\ge1
The following four functions are used in a compression function:
rm{MsgExp}:l{W}32 → l{W}16(Ns+1)
rm{MsgAdd}:l{W}16 x l{W}16 → l{W}16
rm{Mix}j:l{W}16 → l{W}16
rm{WordPerm}:l{W}16 → l{W}16
The overall structure of the compression function is shown in the following figure.
In a compression function, the message expansion function
rm{MsgExp}
(Ns+1)
\{
(i) | |
sf{M} | |
j |
Ns | |
\} | |
j=0 |
sf{M}(i)
sf{T}=(T[0],\ldots,T[15])
i
sf{CV}(i)
j
rm{Step}j
sf{T}
(i) | |
sf{M} | |
j |
sf{T}
sf{T}\leftarrowrm{Step}j\left(
(i) | |
sf{T},sf{M} | |
j |
\right)
j=0,\ldots,Ns-1
rm{MsgAdd}
(i) | |
sf{M} | |
Ns |
(i+1)
sf{CV}(i+1)
sf{T}
rm{CF}
i sf{CV}(i)\inl{W}16 i sf{M}(i)\inl{W}32
(i+1) sf{CV}(i+1)\inl{W}16
\{
\leftarrowrm{MsgExp}\left(sf{M}(i)\right)
sf{T}\leftarrowsf{CV}(i)
j=0 (Ns-1)
sf{T}\leftarrowrm{Step}j\left(
\right)
sf{CV}(i+1)\leftarrowrm{MsgAdd}\left(
\right)
sf{CV}(i+1) |
Here the
j
rm{Step}j:l{W}16 x l{W}16 → l{W}16
rm{Step}j:=rm{WordPerm}\circrm{Mix}j\circrm{MsgAdd}
(0\lej\le(Ns-1))
The following figure shows the
j
rm{Step}j
Let
sf{M}(i)=(M(i)[0],\ldots,M(i)[31])
i
rm{MsgExp}
(Ns+1)
\{
(i) | |
sf{M} | |
j |
Ns | |
\} | |
j=0 |
sf{M}(i)
(i) | |
sf{M} | |
0 |
=(
(i) | |
M | |
0 |
[0],\ldots,
(i) | |
M | |
0 |
[15])
(i) | |
sf{M} | |
1 |
=(
(i) | |
M | |
1 |
[0],\ldots,
(i) | |
M | |
1 |
[15])
(i) | |
sf{M} | |
0 |
\leftarrow(M(i)[0],M(i)[1],\ldots,M(i)[15])
(i) | |
sf{M} | |
1 |
\leftarrow(M(i)[16],M(i)[17],\ldots,M(i)[31])
The next sub-messages
\{
(i) | |
sf{M} | |
j |
=(
(i) | |
M | |
j |
[0],\ldots,
(i) | |
M | |
j |
[15])
Ns | |
\} | |
j=2 |
(i) | |
sf{M} | |
j |
[l]\leftarrow
(i) | |
sf{M} | |
j-1 |
[l]
(i) | |
\boxplussf{M} | |
j-2 |
[\tau(l)]
(0\lel\le15, 2\lej\leNs)
Here
\tau
Z16
l | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
\tau(l) | 3 | 2 | 0 | 1 | 7 | 4 | 5 | 6 | 11 | 10 | 8 | 9 | 15 | 12 | 13 | 14 |
For two 16-word arrays
sf{X}=(X[0],\ldots,X[15])
sf{Y}=(Y[0],\ldots,Y[15])
rm{MsgAdd}:l{W}16 x l{W}16 → l{W}16
rm{MsgAdd}(sf{X},sf{Y}):=(X[0] ⊕ Y[0],\ldots,X[15] ⊕ Y[15])
The
j
rm{Mix}j:l{W}16 → l{W}16
sf{T}=(T[0],\ldots,T[15])
T[l]
T[l+8]
(0\lel<8)
0\lej<Ns
rm{Mix}j
(T[l],T[l+8])\leftarrowrm{Mix}j,l(T[l],T[l+8])
(0\lel<8)
Here
rm{Mix}j,l
X
Y
rm{Mix}j,l:l{W}2 → l{W}2
rm{Mix}j,l
X Y
X Y
X\leftarrowX\boxplusY X\leftarrow
X\leftarrowX ⊕ SCj[l]
Y\leftarrowX\boxplusY Y\leftarrow
X\leftarrowX\boxplusY Y\leftarrow
X Y |
The two-word mix function
rm{Mix}j,l
The bit rotation amounts
\alphaj
\betaj
\gammal
rm{Mix}j,l
w | j | \alphaj | \betaj | \gamma0 | \gamma1 | \gamma2 | \gamma3 | \gamma4 | \gamma5 | \gamma6 | \gamma7 |
---|---|---|---|---|---|---|---|---|---|---|---|
32 | even | 29 | 1 | 0 | 8 | 16 | 24 | 24 | 16 | 8 | 0 |
odd | 5 | 17 | |||||||||
64 | even | 23 | 59 | 0 | 16 | 32 | 48 | 8 | 24 | 40 | 56 |
odd | 7 | 3 |
The
j
sf{SC}j=(SCj[0],\ldots,SCj[7])
rm{Mix}j,l
0\lel<8
sf{SC}0=(SC0[0],\ldots,SC0[7])
1\lej<Ns
j
sf{SC}j=(SCj[0],\ldots,SCj[7])
SCj[l]\leftarrowSCj-1[l]\boxplusSCj-1[l]\lll
0\lel<8
w=32 | w=64 | ||
---|---|---|---|
SC0[0] | 917caf90 | 97884283c938982a | |
SC0[1] | 6c1b10a2 | ba1fca93533e2355 | |
SC0[2] | 6f352943 | c519a2e87aeb1c03 | |
SC0[3] | cf778243 | 9a0fc95462af17b1 | |
SC0[4] | 2ceb7472 | fc3dda8ab019a82b | |
SC0[5] | 29e96ff2 | 02825d079a895407 | |
SC0[6] | 8a9ba428 | 79f2d0a7ee06a6f7 | |
SC0[7] | 2eeb2642 | d76d15eed9fdf5fe |
Let
sf{X}=(X[0],\ldots,X[15])
rm{WordPerm}:l{W}16 → l{W}16
rm{WordPerm}(sf{X})=(X[\sigma(0)],\ldots,X[\sigma(15)])
Here
\sigma
Z16
l | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
\sigma(l) | 6 | 4 | 5 | 7 | 12 | 15 | 14 | 13 | 2 | 0 | 1 | 3 | 8 | 11 | 10 | 9 |
The finalization function
rm{FIN}n:l{W}16 → \{0,1\}n
n
h
sf{CV}(t)=(CV(t)[0],\ldots,CV(t)[15])
sf{H}=(H[0],\ldots,H[7])
sf{h}sf{b}=(hb[0],\ldots,hb[w-1])
w
rm{FIN}n
H[l]\leftarrowCV(t)[l] ⊕ CV(t)[l+8]
(0\lel\le7)
hb[s]\leftarrowH[\lfloor8s/w\rfloor
\ggg(8s\modw) | |
] | |
[7:0] |
(0\les\le(w-1))
h\leftarrow(hb[0]\|\ldots\|hb[w-1])[0:n-1]
Here,
X[i:j]
xi\|xi-1\|\ldots\|xj
X
i\gej
x[i:j]
xi\|xi+1\|\ldots\|xj
l
x=x0\|x1\|\ldots\|xl-1
i\lej
LSH is secure against known attacks on hash functions up to now.LSH is collision-resistant for
q<2n/2
q<2n
q
LSH outperforms SHA-2/3 on various software platforms.The following table shows the speed performance of 1MB message hashing of LSH on several platforms.
Platform | P1 | P2 | P3 | P4 | P5 | P6 | P7 | P8 | |
---|---|---|---|---|---|---|---|---|---|
LSH-256- n | 3.60 | 3.86 | 5.26 | 3.89 | 11.17 | 15.03 | 15.28 | 14.84 | |
LSH-512- n | 2.39 | 5.04 | 7.76 | 5.52 | 8.94 | 18.76 | 19.00 | 18.10 |
The following table is the comparison at the platform based on Haswell, LSH is measured on Intel Core i7-4770k @ 3.5 GHz quad core platform, and others are measured on Intel Core i5-4570S @ 2.9 GHz quad core platform.
Algorithm | Message size in bytes | ||||||
---|---|---|---|---|---|---|---|
long | 4,096 | 1,536 | 576 | 64 | 8 | ||
LSH-256-256 | 3.60 | 3.71 | 3.90 | 4.08 | 8.19 | 65.37 | |
Skein-512-256 | 5.01 | 5.58 | 5.86 | 6.49 | 13.12 | 104.50 | |
Blake-256 | 6.61 | 7.63 | 7.87 | 9.05 | 16.58 | 72.50 | |
Grøstl-256 | 9.48 | 10.68 | 12.18 | 13.71 | 37.94 | 227.50 | |
Keccak-256 | 10.56 | 10.52 | 9.90 | 11.99 | 23.38 | 187.50 | |
SHA-256 | 10.82 | 11.91 | 12.26 | 13.51 | 24.88 | 106.62 | |
JH-256 | 14.70 | 15.50 | 15.94 | 17.06 | 31.94 | 257.00 | |
LSH-512-512 | 2.39 | 2.54 | 2.79 | 3.31 | 10.81 | 85.62 | |
Skein-512-512 | 4.67 | 5.51 | 5.80 | 6.44 | 13.59 | 108.25 | |
Blake-512 | 4.96 | 6.17 | 6.82 | 7.38 | 14.81 | 116.50 | |
SHA-512 | 7.65 | 8.24 | 8.69 | 9.03 | 17.22 | 138.25 | |
Grøstl-512 | 12.78 | 15.44 | 17.30 | 17.99 | 51.72 | 417.38 | |
JH-512 | 14.25 | 15.66 | 16.14 | 17.34 | 32.69 | 261.00 | |
Keccak-512 | 16.36 | 17.86 | 18.46 | 20.35 | 21.56 | 171.88 |
The following table is measured on Samsung Exynos 5250 ARM Cortex-A15 @ 1.7 GHz dual core platform.
Algorithm | Message size in bytes | ||||||
---|---|---|---|---|---|---|---|
long | 4,096 | 1,536 | 576 | 64 | 8 | ||
LSH-256-256 | 11.17 | 11.53 | 12.16 | 12.63 | 22.42 | 192.68 | |
Skein-512-256 | 15.64 | 16.72 | 18.33 | 22.68 | 75.75 | 609.25 | |
Blake-256 | 17.94 | 19.11 | 20.88 | 25.44 | 83.94 | 542.38 | |
SHA-256 | 19.91 | 21.14 | 23.03 | 28.13 | 90.89 | 578.50 | |
JH-256 | 34.66 | 36.06 | 38.10 | 43.51 | 113.92 | 924.12 | |
Keccak-256 | 36.03 | 38.01 | 40.54 | 48.13 | 125.00 | 1000.62 | |
Grøstl-256 | 40.70 | 42.76 | 46.03 | 54.94 | 167.52 | 1020.62 | |
LSH-512-512 | 8.94 | 9.56 | 10.55 | 12.28 | 38.82 | 307.98 | |
Blake-512 | 13.46 | 14.82 | 16.88 | 20.98 | 77.53 | 623.62 | |
Skein-512-512 | 15.61 | 16.73 | 18.35 | 22.56 | 75.59 | 612.88 | |
JH-512 | 34.88 | 36.26 | 38.36 | 44.01 | 116.41 | 939.38 | |
SHA-512 | 44.13 | 46.41 | 49.97 | 54.55 | 135.59 | 1088.38 | |
Keccak-512 | 63.31 | 64.59 | 67.85 | 77.21 | 121.28 | 968.00 | |
Grøstl-512 | 131.35 | 138.49 | 150.15 | 166.54 | 446.53 | 3518.00 |
Test vectors for LSH for each digest length are as follows.All values are expressed in hexadecimal form.
LSH-256-224("abc") =
F7 C5 3B A4 03 4E 70 8E 74 FB A4 2E 55 99 7C A5 12 6B B7 62 36 88 F8 53 42 F7 37 32LSH-256-256("abc") =
5F BF 36 5D AE A5 44 6A 70 53 C5 2B 57 40 4D 77 A0 7A 5F 48 A1 F7 C1 96 3A 08 98 BA 1B 71 47 41LSH-512-224("abc") =
D1 68 32 34 51 3E C5 69 83 94 57 1E AD 12 8A 8C D5 37 3E 97 66 1B A2 0D CF 89 E4 89LSH-512-256("abc") =
CD 89 23 10 53 26 02 33 2B 61 3F 1E C1 1A 69 62 FC A6 1E A0 9E CF FC D4 BC F7 58 58 D8 02 ED ECLSH-512-384("abc") =
5F 34 4E FA A0 E4 3C CD 2E 5E 19 4D 60 39 79 4B 4F B4 31 F1 0F B4 B6 5F D4 5E 9D A4 EC DE 0F 27 B6 6E 8D BD FA 47 25 2E 0D 0B 74 1B FD 91 F9 FELSH-512-512("abc") =
A3 D9 3C FE 60 DC 1A AC DD 3B D4 BE F0 A6 98 53 81 A3 96 C7 D4 9D 9F D1 77 79 56 97 C3 53 52 08 B5 C5 72 24 BE F2 10 84 D4 20 83 E9 5A 4B D8 EB 33 E8 69 81 2B 65 03 1C 42 88 19 A1 E7 CE 59 6DLSH is free for any use public or private, commercial or non-commercial.The source code for distribution of LSH implemented in C, Java, and Python can be downloaded from KISA's cryptography use activation webpage.[2]
LSH is one of the cryptographic algorithms approved by the Korean Cryptographic Module Validation Program (KCMVP).[3]
LSH is included in the following standard.