Hash function, what is it?

Greetings to the dear reader!





Today I would like to talk about what a hash function is, touch on its main properties, give examples of use and in general outline the modern SHA-3 hashing algorithm, which was published as the US Federal Information Processing Standard in 2015.





General information

A cryptographic hash function is a mathematical algorithm that maps arbitrary-sized data into a fixed-size bitmap.





, -, «-» «», «».





- :





) - ̆, -

b) -

c) ̆ , -

d) ̆ -

e) ,





- SHA3-256.





256 , 256 , .





, 64 . , 256 .





: " , , 256 ?"





: 256 !

, 256 - 2 ^ {256} , 2 ^ {256} .

, , :





2 ^ {256} \ approx 1.158 \ times 10 ^ {77}





, , !





.





- .

̆ - ̆:





Pre-image resistance





h, m , h = hash (m)





Second pre-image resistance





m_1, ̆ m_2,





hash (m_1) = hash (m_2)





Collision resistance





m_1 m_2,





hash (m_1) = hash (m_2)





m_1 m_2 -





.





Collision resistance. , , ̆ . , - ̆̆ , , . , ̆ - ̆ , , . - ̆ , , ̆.





, -̆ ̆ , ̆ .





Pre-image resistance. . - , , , . , . .





Second pre-image resistance. . , - . , , , , . , , , hash (m_1) = h, m_2 , hash (m_2) = h





, . -, , .





, , .





, , , .





, - , .





-

-:







- ̆, , , - ̆.







. , . , . -, .







, , . . , -.





:





, . , , . , ( ). , , , . , -, .





SHA-3.





SHA-3

(NIST) 2007—2012 -, SHA-1 SHA-2.





, :

















,









, ISA





5 :





• BLAKE





• Grøstl





• JH





• Keccak





• Skein





SHA-3 Keccak.





Keccak .





Keccak

- ̆ Keccak ̆ , ̆ «» , Z «» .





Keccak Keccak-f, Keccak-f [b], b \ in \ {25, 50, 100, 200, 400, 800, 1600 \}





Keccak-f ̆ , . n_r n_r = 12 + 2l, 2l = b / 25





SHA-3 Keccak-f[1600], n_r = 24





Keccak-f [1600]





, .





1600 , r c , .





, , SHA3-256 r = 1088, c = 512





SHA-3 S 5 \ times 5 w = 64, 5 \ times 5 \ times 64 = 1600 . Keccak w, 2.





- :





• M P ̆ r





• P n r: P_0, P_1,…, P_ {n-1}





• «»: ̆ P_ {i} b (b = r+c) 2 S, f S, 2 P_ {i + 1} f. S 0.





• «»: Z d, d - -, r S Z. f «» , d.





, :









SHA-3 10...1: 1, 0 r - 1 1.





r - 1 , ̆ r - 1 . , r - 1 .





M r, , ̆ ̆ , r - 2 . , , , - .





, - ̆, , .





12 + 2l :





  1. \ theta





  2. \ rho





  3. \ pi





  4. \ chi





  5. \ iota





, , , ,





:





S 5 \ times 5 \ times 64, a [x] [y] [z]





A [x] [y] [z]





ROT (a, d), :









ROT (a [x] [y] [z], d) = a [x] [y] [z + d \: \: mod \: w]



ROT (a, d) - , z z + d \: \: mod \: w,





w- (64 )





, .





\ theta





\ theta : a [x] [y] [z] a [x-1] [\ cdot] [z] a [x + 1] [\ cdot] [z-1]





:





:





\ rho





\ rho ( z).





:





\ pi





\ pi :





\ chi





\ chi Keccak-f





:





\ iota





\ iota . Keccak-f , , . l .





RC [i] w = 64





:





r [x, y] :





, -

SHA-3 Keccak, Secure Hash Algorithm





I hope everything was clear and interesting





Thank you all for your attention!












All Articles