ArticleslgStudy

mathematics

LSH (hash function)

LSH (hash function) is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand LSH (hash function) rather than just read about it. In short: 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).

LSH (hash function) — main illustration
LSH (hash function) — illustration

Key takeaways

  • LSH (hash function) belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect LSH (hash function) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of LSH (hash function) from memory before moving on to harder problems.

Reference excerpt

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.

Illustrations

LSH (hash function): Compression function of LSH
Compression function of LSH
LSH (hash function): The j-th step function Stepj
The j-th step function Stepj
LSH (hash function): Two-word mix function Mixj,l(X,Y)
Two-word mix function Mixj,l(X,Y)

Worked examples

Example 1 — a first encounter with LSH (hash function)

Start with the simplest possible case. Write down what LSH (hash function) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to LSH (hash function) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about LSH (hash function) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of LSH (hash function)

In research
LSH (hash function) appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses LSH (hash function) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
LSH (hash function) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cryptographic algorithms, Cryptographic hash functions, so understanding it makes those chapters shorter.
In everyday life
Look for LSH (hash function) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “LSH (hash function)” →

How to study LSH (hash function) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what LSH (hash function) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain LSH (hash function) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is LSH (hash function) in simple terms?

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

Why does LSH (hash function) matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study LSH (hash function)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on LSH (hash function).

Tags

  • Cryptographic algorithms
  • Cryptographic hash functions

Keep exploring