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. 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).
Specification 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.
Initialization: One-zeros padding of a given bit string message. Conversion to 32-word array message blocks from the padded bit string message. Initialization of a chaining variable with the initialization vector. Compression: Updating of chaining variables by iteration of a compression function with message blocks. Finalization: Generation of an n-bit hash value from the final chaining variable.
The specifications of the hash function LSH are as follows.
Initialization Let m be a given bit string message. The given m is padded by one-zeros, i.e., the bit ‘1’ is appended to the end of m, and the bit ‘0’s are appended until a bit length of a padded message is 32wt, where t=⌈(|m|+1)/32w⌉ and ⌈x⌉ is the smallest integer not less than x. Let mp=m0‖m1‖…‖m(32wt−1) be the one-zeros-padded 32wt-bit string of m. Then mp is considered as a 4wt-byte array ma=(m[0],…,m[4wt−1]), where m[k]=m8k‖m(8k+1)‖…‖m(8k+7) for all 0≤k≤(4wt−1). The 4wt-byte array ma converts into a 32t-word array 𝖬=(M[0],…,M[32t−1]) as follows. M[s]←m[ws/8+(w/8−1)]‖…‖m[ws/8+1]‖m[ws/8] (0≤s≤(32t−1)) From the word array 𝖬, we define the t 32-word array message blocks {𝖬(i)}i=0t−1 as follows. 𝖬(i)←(M[32i],M[32i+1],…,M[32i+31]) (0≤i≤(t−1)) The 16-word array chaining variable 𝖢𝖵(0) is initialized to the initialization vector 𝖨𝖵. 𝖢𝖵(0)[l]←𝖨𝖵[l] (0≤l≤15) The initialization vector 𝖨𝖵 is as follows. In the following tables, all values are expressed in hexadecimal form.
Compression In this stage, the t 32-word array message blocks {𝖬(i)}i=0t−1, which are generated from a message m in the initialization stage, are compressed by iteration of compression functions. The compression function CF:𝒲16×𝒲32→𝒲16 has two inputs; the i-th 16-word chaining variable 𝖢𝖵(i) and the i-th 32-word message block 𝖬(i). And it returns the (i+1)-th 16-word chaining variable 𝖢𝖵(i+1). Here and subsequently, 𝒲t denotes the set of all t-word arrays for t≥1. The following four functions are used in a compression function:
Message expansion function MsgExp:𝒲32→𝒲16(Ns+1) Message addition function MsgAdd:𝒲16×𝒲16→𝒲16 Mix function Mixj:𝒲16→𝒲16 Word-permutation function WordPerm:𝒲16→𝒲16 The overall structure of the compression function is shown in the following figure.
In a compression function, the message expansion function MsgExp generates (Ns+1) 16-word array sub-messages {𝖬j(i)}j=0Ns from given 𝖬(i). Let 𝖳=(T[0],…,T[15]) be a temporary 16-word array set to the i-th chaining variable 𝖢𝖵(i). The j-th step function Stepj having two inputs 𝖳 and 𝖬j(i) updates 𝖳, i.e., 𝖳←Stepj(𝖳,𝖬j(i)). All step functions are proceeded in order j=0,…,Ns−1. Then one more MsgAdd operation by 𝖬Ns(i) is proceeded, and the (i+1)-th chaining variable 𝖢𝖵(i+1) is set to 𝖳. The process of a compression function in detail is as follows.
Here the j-th step function Stepj:𝒲16×𝒲16→𝒲16 is as follows. Stepj:=WordPerm∘Mixj∘MsgAdd (0≤j≤(Ns−1)) The following figure shows the j-th step function Stepj of a compression function.
Message Expansion Function MsgExp Let 𝖬(i)=(M(i)[0],…,M(i)[31]) be the i-th 32-word array message block. The message expansion function MsgExp generates (Ns+1) 16-word array sub-messages {𝖬j(i)}j=0Ns from a message block 𝖬(i). The first two sub-messages 𝖬0(i)=(M0(i)[0],…,M0(i)[15]) and 𝖬1(i)=(M1(i)[0],…,M1(i)[15]) are defined as follows.
𝖬0(i)←(M(i)[0],M(i)[1],…,M(i)[15]) 𝖬1(i)←(M(i)[16],M(i)[17],…,M(i)[31]) The next sub-messages {𝖬j(i)=(Mj(i)[0],…,Mj(i)[15])}j=2Ns are generated as follows.
𝖬j(i)[l]←𝖬j−1(i)[l]⊞𝖬j−2(i)[τ(l)] (0≤l≤15, 2≤j≤Ns) Here τ is the permutation over ℤ16 defined as follows.
Message Addition Function MsgAdd For two 16-word arrays 𝖷=(X[0],…,X[15]) and 𝖸=(Y[0],…,Y[15]), the message addition function MsgAdd:𝒲16×𝒲16→𝒲16 is defined as follows. MsgAdd(𝖷,𝖸):=(X[0]⊕Y[0],…,X[15]⊕Y[15])
Mix Function Mix The j-th mix function Mixj:𝒲16→𝒲16 updates the 16-word array 𝖳=(T[0],…,T[15]) by mixing every two-word pair; T[l] and T[l+8] for (0≤l<8). For 0≤j<Ns, the mix function Mixj proceeds as follows. (T[l],T[l+8])←Mixj,l(T[l],T[l+8]) (0≤l<8) Here Mixj,l is a two-word mix function. Let X and Y be words. The two-word mix function Mixj,l:𝒲2→𝒲2 is defined as follows.
The two-word mix function Mixj,l is shown in the following figure.
The bit rotation amounts αj, βj, γl used in Mixj,l are shown in the following table.
The j-th 8-word array constant 𝖲𝖢j=(SCj[0],…,SCj[7]) used in Mixj,l for 0≤l<8 is defined as follows. The initial 8-word array constant 𝖲𝖢0=(SC0[0],…,SC0[7]) is defined in the following table. For 1≤j<Ns, the j-th constant 𝖲𝖢j=(SCj[0],…,SCj[7]) is generated by SCj[l]←SCj−1[l]⊞SCj−1[l]⋘8 for 0≤l<8.
Word-Permutation Function WordPerm Let 𝖷=(X[0],…,X[15]) be a 16-word array. The word-permutation function WordPerm:𝒲16→𝒲16 is defined as follows. WordPerm(𝖷)=(X[σ(0)],…,X[σ(15)]) Here σ is the permutation over ℤ16 defined by the following table.
Finalization The finalization function FINn:𝒲16→{0,1}n returns n-bit hash value h from the final chaining variable 𝖢𝖵(t)=(CV(t)[0],…,CV(t)[15]). When 𝖧=(H[0],…,H[7]) is an 8-word variable and 𝗁𝖻=(hb[0],…,hb[w−1]) is a w-byte variable, the finalization function FINn performs the following procedure.
H[l]←CV(t)[l]⊕CV(t)[l+8] (0≤l≤7) hb[s]←H[⌊8s/w⌋][7:0]⋙(8smodw) (0≤s≤(w−1)) h←(hb[0]‖…‖hb[w−1])[0:n−1] Here, X[i:j] denotes xi‖xi−1‖…‖xj, the sub-bit string of a word X for i≥j. And x[i:j] denotes xi‖xi+1‖…‖xj, the sub-bit string of a l-bit string x=x0‖x1‖…‖xl−1 for i≤j.
… excerpt ends here. Continue reading the full article.



