LSH (hash Function)
   HOME

TheInfoList



OR:

LSH is a
cryptographic hash function A cryptographic hash function (CHF) is a hash algorithm (a map (mathematics), map of an arbitrary binary string to a binary string with a fixed size of n bits) that has special properties desirable for a cryptography, cryptographic application: ...
designed in 2014 by
South Korea South Korea, officially the Republic of Korea (ROK), is a country in East Asia. It constitutes the southern half of the Korea, Korean Peninsula and borders North Korea along the Korean Demilitarized Zone, with the Yellow Sea to the west and t ...
to provide integrity in general-purpose software environments such as PCs and
smart device A smart device is an electronic device, generally connected to other devices or networks via different wireless protocols (such as Bluetooth, Zigbee, near-field communication, Wi-Fi, NearLink, Li-Fi, or 5G) that can operate to some extent inte ...
s. 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 = \lceil (, m, + 1)/32w\rceil and \lceil x \rceil is the smallest integer not less than x . Let m_p = m_0 \, m_1 \, \ldots \, m_ be the one-zeros-padded 32wt -bit string of m . Then m_p is considered as a 4wt -byte array m_a = (m \ldots , m wt-1 , where m = m_ \, m_ \, \ldots \, m_ for all 0 \le k \le (4wt-1) . The 4wt -byte array m_a converts into a 32t -word array \textsf = (M \ldots , M 2t-1 as follows. M \leftarrow m s/8+(w/8-1)\, \ldots \, m s/8+1\, m s/8/math> (0 \le s \le (32t-1)) From the word array \textsf , we define the t 32-word array message blocks \_^ as follows. \textsf^ \leftarrow (M 2i M 2i+1 \ldots , M 2i+31 (0 \le i \le (t-1)) The 16-word array chaining variable \textsf^ is initialized to the initialization vector \textsf . \textsf^ \leftarrow \textsf /math> (0 \le l \le 15) The initialization vector \textsf 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 \_^ , which are generated from a message m in the initialization stage, are compressed by iteration of compression functions. The compression function \textrm : \mathcal^ \times \mathcal^ \rightarrow \mathcal^ has two inputs; the i -th 16-word chaining variable \textsf^ and the i -th 32-word message block \textsf^ . And it returns the (i+1) -th 16-word chaining variable \textsf^ . Here and subsequently, \mathcal^t denotes the set of all t -word arrays for t \ge 1 . The following four functions are used in a compression function: * Message expansion function \textrm: \mathcal^ \rightarrow \mathcal^ * Message addition function \textrm: \mathcal^ \times \mathcal^ \rightarrow \mathcal^ * Mix function \textrm_j: \mathcal^ \rightarrow \mathcal^ * Word-permutation function \textrm: \mathcal^ \rightarrow \mathcal^ The overall structure of the compression function is shown in the following figure. In a compression function, the message expansion function \textrm generates (N_s+1) 16-word array sub-messages \_^ from given \textsf^ . Let \textsf = (T \ldots , T 5 be a temporary 16-word array set to the i -th chaining variable \textsf^ . The j -th step function \textrm_j having two inputs \textsf and \textsf_j^ updates \textsf , i.e., \textsf \leftarrow \textrm_j \left( \textsf, \textsf_j^ \right) . All step functions are proceeded in order j = 0, \ldots, N_s - 1 . Then one more \textrm operation by \textsf_^ is proceeded, and the (i+1) -th chaining variable \textsf^ is set to \textsf . The process of a compression function in detail is as follows. Here the j -th step function \textrm_j : \mathcal^ \times \mathcal^ \rightarrow \mathcal^ is as follows. \textrm_j := \textrm \circ \textrm_j \circ \textrm (0 \le j \le (N_s-1)) The following figure shows the j -th step function \textrm_j of a compression function.


Message Expansion Function MsgExp

Let \textsf^ = ( M^ \ldots , M^ 1) be the i -th 32-word array message block. The message expansion function \textrm generates (N_s + 1) 16-word array sub-messages \_^ from a message block \textsf^ . The first two sub-messages \textsf_^ = ( M_^ \ldots , M_^ 5) and \textsf_^ = ( M_^ \ldots , M_^ 5) are defined as follows. * \textsf_0^ \leftarrow (M^ M^ \ldots , M^ 5 * \textsf_1^ \leftarrow (M^ 6 M^ 7 \ldots , M^ 1 The next sub-messages \_^ are generated as follows. * \textsf_j^ \leftarrow \textsf_^ \boxplus\textsf_^ tau(l)/math> (0 \le l \le 15, \ 2 \le j \le N_s) Here \tau is the permutation over \mathbb_ defined as follows.


Message Addition Function MsgAdd

For two 16-word arrays \textsf = (X \ldots , X 5 and \textsf = (Y \ldots , Y 5 , the message addition function \textrm : \mathcal^ \times \mathcal^ \rightarrow \mathcal^ is defined as follows. \textrm( \textsf, \textsf ) := (X \oplus Y \ldots , X 5\oplus Y 5


Mix Function Mix

The j -th mix function \textrm_j: \mathcal^ \rightarrow \mathcal^ updates the 16-word array \textsf = (T \ldots , T 5 by mixing every two-word pair; T and T +8 for (0 \le l < 8) . For 0 \le j < N_s , the mix function \textrm_j proceeds as follows. (T T +8 \leftarrow \textrm_(T T +8 (0 \le l < 8) Here \textrm_ is a two-word mix function. Let X and Y be words. The two-word mix function \textrm_ : \mathcal^2 \rightarrow \mathcal^2 is defined as follows. The two-word mix function \textrm_ is shown in the following figure. The bit rotation amounts \alpha_j, \beta_j, \gamma_l used in \textrm_ are shown in the following table. The j -th 8-word array constant \textsf_j = (SC_j \ldots , SC_j used in \textrm_ for 0 \le l < 8 is defined as follows. The initial 8-word array constant \textsf_0 = (SC_0 \ldots , SC_0 is defined in the following table. For 1 \le j < N_s , the j -th constant \textsf_j = (SC_j \ldots , SC_j is generated by SC_j \leftarrow SC_ \boxplus SC_ for 0 \le l < 8 .


Word-Permutation Function WordPerm

Let \textsf = (X \ldots , X 5 be a 16-word array. The word-permutation function \textrm : \mathcal^ \rightarrow \mathcal^ is defined as follows. \textrm( \textsf) = (X sigma(0) \ldots , X sigma(15) Here \sigma is the permutation over \mathbb_ defined by the following table.


Finalization

The finalization function \textrm_n : \mathcal^ \rightarrow \^ returns n -bit hash value h from the final chaining variable \textsf^ = ( CV^ \ldots , CV^ 5. When \textsf = (H \ldots , H is an 8-word variable and \textsf_\textsf = (h_b \ldots , h_b -1 is a w -byte variable, the finalization function \textrm_n performs the following procedure. * H \leftarrow CV^ \oplus CV^ +8/math> (0 \le l \le 7) * h_b \leftarrow H lfloor 8s/w\rfloor _ (0 \le s \le (w-1)) * h \leftarrow (h_b \, \ldots \, h_b -1_ Here, X_ denotes x_i \, x_ \, \ldots \, x_j , the sub-bit string of a word X for i \ge j . And x_ denotes x _i \, x_ \, \ldots \, x_j , the sub-bit string of a l -bit string x = x_0 \, x_1 \, \ldots \, x_ for i \le j .


Security

LSH is secure against known attacks on hash functions up to now. LSH is collision-resistant for q < 2^ and preimage-resistant and second-preimage-resistant for q < 2^n in the ideal cipher model, where q is a number of queries for LSH structure. LSH-256 is secure against all the existing hash function attacks when the number of steps is 13 or more, while LSH-512 is secure if the number of steps is 14 or more. Note that the steps which work as security margin are 50% of the compression function.


Performance

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. 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. The following table is measured on Samsung Exynos 5250 ARM Cortex-A15 @ 1.7 GHz dual core platform.


Test vectors

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 32 LSH-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 41 LSH-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 89 LSH-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 EC LSH-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 FE LSH-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 6D


Implementations

LSH 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.


KCMVP

LSH is one of the cryptographic algorithms approved by the Korean Cryptographic Module Validation Program (KCMVP).


Standardization

LSH is included in the following standard. * KS X 3262, Hash function LSH (in Korean)


References

{{cryptography navbox, hash Cryptographic hash functions Cryptographic algorithms