IT Hash Functions
IT Hash Functions
Agenda
General presentation of cryptological context of hash function usage; Preliminary notions; Hash functions; Attacks on hash functions & Examples; Applications; References; Q&A.
Beside the fact that the receiver of a message must be sure that the received message is coming from the real sender , an authentication system must solve eventually disagreements which can appear between the sender and receiver. In e-mail case the solution is based on CRIPTO protocols which involve the digital signature.
6
Digital signatures
Digital signature must have the following (theoretically) properties:
- the signature is unforgeable. The signature is proof that the signer, and no one else, deliberately signed the document; - the signature is authentic. The signature convinces the documents recipent that the signer deliberately signed the document; - the signature is not reusable. The signature is part of the document, an unscrupulous person cannot move the signature to a different document; - the signed document is unalterable. After the document is signed, it cannot be alternated; - the signature cannot be repudiated. The signature and the document are physical thinks. The signer cannot later claim that he or she didnt sign it.
1) Usage symmetric cryptosystems; 2) Usage asymmetric cryptosystems; 3) Need for one way functions: data integrity code (DIC), manipulation detection code (MDC), message authentication code (MAC), data authentication code (DAC); 4) Conventional Digital signatures: - ElGamal; - Schnorr; - DSA (Digital Signature Algorithm) designed by NSA; 5) Other types of digital signatures: - invisible signature (only the legitimate user can see the signature); - fail-stop signature (in case of a forgery signer can proof data manipulation). 6) Standards & Legal Issues.
8
From left to right: Adi Shamir, Ron Rivest, Len Adleman, Ralph Merkle, Martin Hellman, and Whitfield Diffie.
Ellis, Cocks, Williamson. In December, 1997, it was revealed that researchers at the GCHQ organization did some work in the early 1970's in the field of "non-secret encryption", which is related to public key cryptography, but without inclusion of the concept of digital signatures. However, these claims are not verifiable since the work was not published, and there are no evidentiary artifacts available such as original copies of the papers (although modern transcriptions are linked below). Therefore, in keeping with a long tradition, credit for the development and publication of PKC must remain with the researchers who first published their work in the open scientific literature, as described above.
12
13
One-Way Functions
Function f is called one-way if: 1) given the value x, it is easy to compute f(x); 2) given f(x), it is computationally difficult to compute the input x. Function f is one-way with trap-door if: 1) given the value x, it is easy to compute f(x); 2) given f(x), it is computationally difficult to compute the input x; 3) based on a ,,secret information y, it is easy to compute x from f(x).
14
Discrete logarithm: given p (prim number), g and y find the value x such that gx =y mod p; Factorization: if N is the product of two prime numbers (unknown) then: 1) find the factors of N; 2) given e si C, find M such that Me = C mod N; 3) given M si C find the value d such that Cd = M mod N; 4) given x, decide if there is a value y such that x = y2 mod N.
Knapsack problem: given a set of integer values find a subset with sum S.
15
Hash functions
Definitions; Hashing algorithms; Hash function based on block ciphers; Hash function not based on block ciphers; Examples.
16
Definitions
Hash function is a function which input is an arbitrary length bit string and output a bit string of fixed length (generally output length is 64, 128 or 256 bits);
A function H is called one-way hash function if: 1) H is hash function; 2) H is one-way function.
For to be used in cryptographic applications ( example in connection with digital signatures) one-way hash functions must provide: 1) for every (given) M, it is difficult to find M such that H(M)=H(M); 2) it is difficult to find a pair (M, M ) such that H(M)=H(M).
17
Hashing algorithms
Some one-way hash functions produce the output of length n based on two inputs on the same length n. In generally, in this case the input is a block of the message (part of a message) and the previous block hash, that is hi=f(Mi,hi-1).
18
D = 2 64
Message text.....
H H H
H(M) = H(M*)
M*
m(1)
m(2)
m(3)
m(i)
............
m(n)
H(i-1)
H(i)
H(n)
Compression function f
19
1) 2) 3) 4)
RSA type: Hi =(Mi Hi-1)e mod N, where e and N are public; Quadratic type: Hi extracts m bits from (00111111||Hi||Mi)2 mod N; There are hashing schemes based on cellular automata, Fourier transform etc; From hash function non-based on block ciphers we remember MD2, MD4 and MD5 designed by Ron Rivest, SHA designed by NSA (also FIPS standard), RIPEMED designed by den Boer (RACE european project) and MDC2 designed by IBM.
21
22
For testing implementation and the results we may use OpelSSL or others software designed to run on Windows OS such as HashCalc (desiged by SlavaSoft) .
23
Types of attacks on hash functions; Example: MD5 attack (description, Wangs attack).
24
25
26
Floyds searching algorithm is: - iterative; - used for elimination storage requirements; - algorithm is described in D. Knuth, Semi-numerical algorithms, vol. 2 INPUT: pair (x1 ,x2 ) of integer numbers between 0 and p-1 h iteration function which takes values between 0 and p-1; OUTPUT: value m for which xm=x2m; STEP 1: compute iteratively using function h the pair (xi,x2i) form the precedent pair (xi-1,x2i-2 ) until xm=x2m; Remarks: a) if the queue of the sequence has length l and the cycle has length t then the first time when xm=x2m is achieved for t(1+[l/t]); b) let us note that l<m<l+t thus the running time of this algorithm is O(n1/2).
27
They found collisions on MD5 & SHA functions and methods for generating this collisions [2], [3] si [4].
28
42 years old prof. Xiaoyun Wang and her research group had cracked major U.S. government algorithm used in digital signatures in year 2004. Prof. Wang is a mathematician, expertising in number theory. Her team consists of eight Chinese researchers, out of which six are female mathematicians/computer scientists. Prof. Wang said: We are used to thinking in the way of mathematics. Once mathematics became our instincts, we view numbers as beautiful music notes. Our research is as interesting and creative as composing music.
29
Presented in the paper X. Wang, D. Feng, X. Lai, H. Yu, "Collisions for Hash Functions MD4, MD5, HAVAL-128 and RIPEMD", rump session, CRYPTO 2004, Cryptology ePrint Archive, Report 2004/199, http://eprint.iacr.org/2004/199. They present collisions on MD5 function but no given details (at that time) how to generate them.
30
MD5 inventor
Ronald Linn Rivest (born 1947, Schenectady, New York) is a cryptographer. He is also the inventor of the symmetric key encryption algorithms RC2, RC4, RC5, and co-inventor of RC6. The "RC" stands for "Rivest Cipher", or alternatively, "Ron's Code". (RC3 was broken at RSA Security during development; similarly, RC1 was never published.) He also authored the MD2, MD4 and MD5 cryptographic hash functions.
31
33
x[0] x[1]
H(i-1)
Differential scheme
A change in one word x[i] leads to four changes, what leads to many changes in the next steps
Presetting values of some bits of Q[] enables to control the changes through the scheme this are called stationary conditions.
x[2] ... x[15] ... x[1] x[6] x[11] x[0] ... ... new calculated values: Q[1] Q[2] ...... Q[64] final addition: H[0..3] = IV + (Q[61],..,Q[64])
64
. . .
m(i)
...
H(i-1)
H(i)
H(i)
34
35
36
H1
f
H2
H1* - H1 = (0, +231+225, +231+225, +231+225) , collision generated on one hour on an IBM P690 machine H2* - H2 = (0,0,0,0), second collision generated in about 15s5min.
H1*
M*
N*
37
Derive a table of sufficient conditions for the characteristics to hold: first iteration differential and second iteration differential;
38
39
Message of 1024 bits length composed from blocks M* and N* of 512 bits length each:
313838DD FC2932C7 C030B717 BAFC1BAE E673A8D7 9DDCF416 85D70859 99403DB0 0634ADD1 C0736004 9558BD1F 21E18982 CA94C90B 6AAE6E69 4BF61BF1 06B0E615 2E82D48B 16BDF161 CE10BD62 C3C6809D 36745639 FC0E06C7 6573A914 BEF0D753 537B8755 497B92E8 46F559C2 7D79B47A 0511D8B1 98EBEB68 49CA4559 EB10E037
Worked for Czech National Security Authority, chief of R&D group (1981-1992) now independent cryptologist.
41
Presented in the paper of Vlastimil Klima Finding MD5 Collisions on a Notebook PC Using Multi-message Modifications; He present a different method of generating collisions on MD5 hash function (the set of Wangs conditions were not sufficient, corrected by Jun Yajima and Takeshi Shimoyama from FUJITSU LABORATORIES LTD.
Klimas method is about 3-6 faster then Wang & Yu techniques (due insufficient conditions).
42
Message of 1024 bits length composed from blocks M* and N* of 512 bits length each:
3349F5AC A9741EDE E5B448C0 DB33CDD6 16E9A9A6 5C958038 DE975790 BF8D3F87 55AD3405 066EB4A0 FBFB907C 537B0254 1FADB99D 25D9FA81 A35F5A6C 4AEAC35A 25083C72 DFDD16EA AFEE301A 7003F1E2 D69377B5 0CF70D3D 1ADD33E7 4F9BDDDC 45D0FBF8 EF9F1BA7 D69BC765 794C569D BC8877BB 7A134473 6F1D7174 4DE89889
Others applications
1) Hash functions MD4, MD5, SHA-0 si SHA-1, RIPEMD; - characteristics, evaluation criteria of hash functions; - preimage attack; - birthday attack; - generation collisions/pseudocollisions; - meet in the middle attack. 2) Area of applicability: - cryptographic protocols identification/authentication key agreement etc;
44
Prover A
Ki Rt
Verifier
Ki Rv
Who are you? : proof by using Rv that you know Ki Generate random value Rv Auth request (Challenge) RES=F(Rt, Ki, Rv) I am A, and this is the proof: RES, Rt (Response) If RES = F(Ki, Rt, Rv) then accept
45
References
1. Menenzes A.J., et. al., Handbook of Applied Cryptography, CRC Press, 1997. 2. Schneier B., Applied Cryptography, Adison-Wesley, 1998. 3. Simion E., Preda V., Popescu A., Criptanaliza. Rezultate si Tehnici Matematice, Ed. Universitatii Bucuresti, 2004. 4. Stallings W., Cryptography and Network Security: Principles and Practice, Prentice Hall, Second Edition, 1999. 5. Tilborg, Henk C.A. van, Fundamentals of Cryptology, Kluwer Academic Publisher, Second Edition, 2001.
46
47