a6a0f22b1863caf1f9e9b9bb131bbc21.ppt
- Количество слайдов: 51
해싱 함수의 종류에 대해 조사 해보자 (대수적 코딩 , 난수발생 , 유니버셜 해싱, On-way hash function) 발표자: 엄명용(20023976)
해싱함수란? 레코드 키(key)들의 집합을 버켓(Bucket) 주소의 집합에 대응시킨다는 의미에서 사 상함수(mapping function)라고도 한다. 가 장 이상적인 해 싱 함수는 키 집합의 한 레 코드(record)와 버 켓 주소 집합의 한 레코 드가 1 : 1 대응하여 해시 테이블의 정해진 범위에 고르게 분포되어 있어서 충돌을 최 소화 하도록 하는 것이다.
그림으로 본 해싱함수 n n 해 싱 함 수 (Hashing function) - 레 코 드 키 값(k) → 해싱 함수 h(k)→ 해상표의 상 대주소
책에 있는내용 1 1)제산잔여해싱(divide and remainder) *주소수보다 작고 제일큰 Prime number 로 나눈다. 2)중간제곱해싱(mid-square) *제곱후 가운데 자리수 추출 3)중첩해싱(folding) *숫자를 접어서 더 한후 접은 자리수 만큼 추출
책에 있는 내용 2 4)숫자추출방법(digit extraction) 의미 있다고 판단되는 몇가지 자리수만 추 출하는 방법(예 학번, 주민등록번호) 5)숫자이동변환(shifting) 중앙을 중심으로 주소길이만큼 나눈 후 좌 우를 각각 시프트 시켜서 더하는 방법 6)진수변환(radix conversion) 키값을 다른진수로 변환 주소자리만큼 추출.
대수적 코딩(algebraic coding ) Is)키의 구성하는 각 자리의 비트 수를 다항 의 계수로 간주하고, 해시 표에서 크기로 정한 다항식으로 나누어 나머지를 주소 값 으로 하는 방법. 예)데이터 통신에서 CRC발생기와 같은 원 리로 이해됨. 다른점은 나머지가 주소임. 001= (111101)mod(1101)
2진나눗셈의 예 (데이타통신책)
Pseudo Random(가 랜덤) Is)난수를 발생하여 주소 를 정함 충돌이 발 생할 경우 다음 난 수를 발생하여 주소를 정한다. 난 수에 적당한 상수를 곱해서 주소 값을 정할 수 있다. 참고)GPS나 위성에 사용한다고 한다.
유니버셜 해싱 Is) 해시 함수마다 나쁜 성능을 보이는 입력 데이터가 존제 한다. 실행시에 큰 해시함수집합에서 임의이 해 시함수를 선택하게 해서 해시함수의 편향 된 사용이 불가능 하도록 하는 방법이다. (해시함수가 여러 개가 사용된다는 의미에 서 중첩해싱과 비슷하지만 한 데이타에 한 개의 해시함수가 사용된다는 차이가 있다. )
On-way hash function One-way hash function: h=H(M) (M: 임의 길이 msg. h: 고정길이 hash값) one-way hash function이 가지는 추가적 특징: 1)M이 주어 졌을 때, h는 쉽게 계산된다. 2)h가 주어 졌을 때, H(M)=h인 m을 구하기는 많이 어렵 다. 3)M이 주어 졌을 때, H(M)=H(M`)인 다른 메시지인 M` 을 구하기도 어렵다.
On-way hash function One-way hash function: h=H(M) (M: 임의 길이 msg. h: 고정길이 hash값) one-way hash function이 가지는 추가적 특징: 1)Given M, it is easy to compute h. 2)Given h, it is hard to compute M such that H(M)=h. 3)Given M, it is hard to find another message, M`, such that H(M)=H(M`).
Hash function 만드는 방법 n n 64 bit는 birthday attack에 약해 128 bit를 실제적으로 사용 주어진 hash function보다 더 긴 hash 값을 얻기 위한 방법 hi=f(Mi, hi-1) (1) msg의 hash 값을 생성 n (2) hash값을 msg에 붙인다. n (3) 연결된 값의 hash값을 생성 n (4) 더 긴 hash 값을 생성((3), (1)에서 생성된 값들로 구성) n (5) 단계 (1), (3)을 반복한다. n n 이 방법은 아직 Secure한지 판명되지 않았다
Birthday Attack 이란 n 365일중 불과 23명이상 만 되어도 생일이 같을 확률이 ½가 넘는 현상을 말한다. 여기 에 기인한 On-way hash function 의 약 점공격
Birthday Attack의 문제 MD 4 32비트 입력알고리즘으로 128비트 출력이 나오며 충돌 쌍 찾는데, 2^64 같은 h를 찾는 데는 적어도 2^128승의 계산이 필요하다는 이론이었으나 Birthday Attack Paradox 에 의해서 2^20만에 충돌 쌍이 발견되었다. 이 로 인해 MD 5가 나오게 된 계기가 되었다. 이후에는 SHA-1, RIPE-MD, HAVAL등등이 나오게 되었다. 최근에는 인터넷 뱅킹등에 쓰이고 있는 SHA 마저도 안전 하지 않다는 이야기가 나오고 있다.
그밖에 On way Hash functioin n n n Snefru N-hash Secure Hash Algorithm(SHA) RIPE-MD MD 3 MD 5 Symmetric Block Algorithms
아래는 참고 자료입니다.
Snefru(1/2) n n Designed by Ralph Merkle. 임의 길이 message를 128 혹은 256 bit값으로 hash. message를 chunks(각각 512 -m in length)로 나눈다. (m은 hash값의 길이) 알고리즘의 핵심은 function H. n n 현재 블록과 이전 블록의 hash값을 붙여서 hash함수 수행. H는 마지막 E의 출력 m-bit xor 처음 E의 입력 m-bit Hash함수는 E(reversible block-cipher 함수)에 기초. function E (Security상 중요) n n 여러 pass를 통해 data를 random하게 생성 각 pass는 64 randomizing round로 구성
Snefru(2/2) n Cryptanalysis of Snefru n n differential attack을 통해 insecurity하다는 것을 증명 (Biham and Shamir에 의해) 128 bit Snefru에서 같은 값으로 hash되는 message 쌍 birthday attack : 264 n differential cryptanalysis : 228. 5(3 pass), 224. 5(4 pass) n n 128 bit Snefru에서 주어진 값으로 hash되는 message brute force attack : 2128 n differential cryptanalysis : 256(3 pass) , 288(4 pass) n n n 8 pass이상 사용을 추천. Pass수가 많아지면 MD 5나 SHA보다 느려짐
N-Hash(1/3) n N-Hash n n n Nippon Telephone and Telegraph에서 개발 128 bit message block을 사용하여 128 bit hash 값 생성 FEAL과 유사한 복잡한 randomizing function사 용 n n H 0 =I, where I is a random initial value Hi=g(Mi , Hi-1 ) xor Mi xor Hi-1
N-Hash(2/3) n Processing stage message block은 4개의 32 bit 값으로 나뉨. n 이전 hash값 또한 4개의 32 bit 값으로 나뉨. n n n S 0(a, b)=rotate left two bits((a+b) mod 256) S 1(a, b)=rotate left two bits((a+b+1) mod 256)
N-Hash(3/3) n Cryptanalysis of N-Hash n n Bert den Boer은 N-Hash round 함수에서 collision 을 생성하는 방법을 발견 Biham과 Shamir은 6 round N-Hash를 깨기 위해 differential attack을 사용. (3으로 나누어지는 N에 대 해서 잘 동작) 8 round이상을 가진 N-Hash 사용을 추천 다른 알고리즘을 사용하는 것을 추천
MD 4 n n n Ron Rivest에 의해 설계(MD(Message Digest). 128 bit hash 혹은 message digest를 생성 Design Goals Security n Direct Security n Speed n Simplicity and Compactness n Favor Little-Endian Architectures n n Rivest는 알고리즘을 더욱 강하게 만들었다. (MD 5)
MD 5(1/3) n Description of MD 5 n n input : 512 bit blocks(16개의 32 bit block으로 나눔) output: 4개의 32 bit block을 128 bit로 연결. n 4개의 32 bit 변수사용(chaining variables) n n A=0 x 01234567, B=0 x 89 abcdef C=0 xfedcba 98, D=0 x 76543210 Main loop은 메시지에 512 bit block의 수 만큼 반복. Main loop은 4 round를 가지 고, 각 round는 16번의 다른 operation을 수행
MD 5 (2/3) n 4개의 nonlinear functions(각 operation에 하나가 사용) n n n F(X, Y, Z)=(X^Y) v ((ㄱX)^Z) G(X, Y, Z)=(X^Z) v (Y^(ㄱZ)) H(X, Y, Z)=X xor Y xor Z I(X, Y, Z)=X xor (X v (ㄱZ)) 4개의 operation (Mj는 j번째 subblock) n n FF(a, b, c, d, Mj, s, tj) denotes a=b+((a+F(b, c, d)+Mj+ti)<<<s) GG(a, b, c, d, Mj, s, tj) denotes a=b+((a+G(b, c, d)+Mj+ ti)<<<s) HH(a, b, c, d, Mj, s, tj) denotes a=b+((a+H(b, c, d)+Mj+ ti)<<<s) II(a, b, c, d, Mj, s, tj) denotes a=b+((a+I(b, c, d)+Mj+ ti)<<<s)
MD 5 (3/3) n Security of MD 5 n improvement of MD 5 over MD 4 n n n 1. 4번째 round가 추가 2. 각 step은 unique additive constant를 가짐 3. 2 round에서 사용한 함수G를 변화. 4. 각 step은 이전 step의 결과를 더함(faster avalanche effect) 5. 2, 3 round에서 접근한 sub-block의 순서를 바꿈. 6. 각 round에서 왼쪽 shift되는 양은 대체적으로 최적화되어 있다.
Secure Hash Algorithm(SHA)(1/4) n n NIST가 설계. (Digital Signature Standard와 함께 사용) Description of SHA n 5개의 32 bit 변수를 초기화 n n n n A=0 x 67452301 B=0 xefcdab 89 C=0 x 98 badcfe D=0 x 10325476 E=0 xc 3 d 2 e 1 f 0 main loop은 20 operation의 4 round를 가짐. SHA’s nonlinear functions : n ft(X, Y, Z)=(X^Y)v((ㄱX)^Z), for t=0 to 19
Secure Hash Algorithm(SHA)(2/4) n n 알고리즘에 사용되는 4개의 constants n n n ft(X, Y, Z)=X xor Y xor Z, for t=20 to 39 ft(X, Y, Z)=(X^Y)v(X^Z)v(Y^Z), for t=40 to 59 ft(X, Y, Z)= X xor Y xor Z, for t=60 to 79. Kt=0 x 5 a 827999, for t=0 to 19. Kt=0 x 6 ed 9 eba 1, for t=20 to 39. Kt=0 x 8 f 1 bbcdc, for t=40 to 59. Kt=0 xca 62 c 1 d 6, for t=60 to 79. Msg block은 16개 32 bit block(M 0 - M 15)에서 80개 32 bit block(W 0 -W 79) n n Wt = Mt, for t=0 to 15 Wt =(Wt-3 xor Wt-8 xor Wt-14 xor Wt-16 ) <<<1, for t=16 to 79
Secure Hash Algorithm(SHA)(3/4) n Main loop : n (t : operation number(0 -79) Wt : t 번째 확장된 msg의 sub-block For t=0 to 79 temp =(a<<<5) + ft(b, c, d) + e + Wt + Kt e=d d=c c=b <<<30 b=a a=TEMP
Secure Hash Algorithm(SHA)(4/4) n Security of SHA n n n MD 4와 유사하며 160 bit hash 값을 가진다. Extend transformation과 이전 step의 output을 다음 step에 더함. MD 5가 MD 4에 대한 개선 사항 n n n 4번째 round 추가 (SHA) 각 step은 유일한 additive constant를 가짐(SHA=MD 4) round 2에서의 function G가 변화(SHA=MD 4) 각 step은 이전 step의 결과를 더함(SHA) 접근하는 sub-block의 순서를 바꾼다. (SHA는 완전히 다 름) shift되는 양을 각 round에서 최적화(SHA는 각 round에 대해서 일정)
RIPE-MD n n n European Community’s RIPE project에 의해 개 발 MD 4의 변형 128 bit hash 값 생성 rotation과 message word의 순서가 변경 알고리즘의 2개의 instances는 병렬 수행. 2 instances의 출력은 chaining variables에 더 함.
HAVAL n n n 가변길이 One-way hash function. Round수 가변(3에서 5사이) hash length(128, 160, 192, 224, 256 bits) high nonlinear 7 variable 함수(avalanche를 위해) 각 round에서 하나의 함수를 사용하지만 모든 step에서 다른 permutation을 수행. Core of algorithm n n n temp=(f(j, A, B, C, D, E, F, G)<<7)+(H<<<1)+M[i][r(j)]+k(j) H=G; G=F; F=E; E=D; D=C; C=B; B=A; A=temp Den Boer’s and Bosselaers’s attack을 적용할 수 없다.
Other One-way Hash function n MD 3 n n iterated exponentiation에 기초한 one-way hash function n n University of Waterloo에서 제안 message를 593 bit로 나눈다. Ivan Damgard가 설계한 one-way hash function n n Ron Rivest가 설계했으나 결점이 있어 거의 사용 안함 knapsack problem을 기초로 설계 Steve Wolfram’s cellular automata Claus Schnorr이 제안한 one-way hash function n discrete Fourier transform에 기초(FFT-Hash II라 불림)
One-Way Hash Functions Using Symmetric Block Algorithms(1/12) the Hash n Schemes Where Length Equals the Block Size n General scheme n n n H 0 = IH, where IH is random initial value. Hi = EA(B) xor C A, B, C는 Mi, Hi-1, (Mi xor Hi-1) 혹은 constant가 될 수 있다.
One-Way Hash Functions Using Symmetric Block Algorithms (2/12) n Insecure한 schemes Hi=EMi(Hi-1) n Hi= EMi xor Hi-1(Hi-1) n Hi=Ec(Mi xor Hi-1) xor Mi xor Hi-1 n
One-Way Hash Functions Using Symmetric Block Algorithms (3/12) n Modified Davies-Meyer n n Lai와 Massey가 IDEA cipher와 동작하도록 Davies-Meyer technique을 변경. IDEA는 64 bit block size와 128 bit key size를 가짐. n n n H 0 = IH, where IH is random initial value. IH = EHi-1, Mi(Hi-1) Message를 64 bit 블록으로 나누고 64 bit hash값을 생성.
One-Way Hash Functions Using Symmetric Block Algorithms (4/12) n Preneel-Bosselaers-Govaerts-Vandewalle n n n block길이의 2배에 해당하는 hash값 생성. 64 bit block 알고리즘은 2개의 64 bit hash값을 생성 (Gi, Hi) 2개의 인접 message 블록(Li 와 Ri) G 0=IG, where IG is a random initial value n H 0=IH, where IH is another random initial value n Gi= ELi xor. Hi-1(Ri xor Gi-1) xor Ri xor Gi-1 xor Hi-1 n Hi = Eli xor Ri(Hi-1 xor Gi-1) xor Li xor Gi-1 xor Hi-1 n n successful attacks (Don’t use it)
One-Way Hash Functions Using Symmetric Block Algorithms (5/12) n Quisquater-Girault n n block길이의 2배가 되는 hash값 2개의 hash값(Gi, Hi)과 2개의 블록(Li, Ri)을 가짐 n n n G 0=IG, where IG is a random initial value H 0=IH, where IH is another random initial value Wi= ELi(Gi-1 xor Ri) xor Ri xor Hi-1 Gi = ERi(Wi xor Li) xor Gi-1 xor Hi-1 xor Li Hi = Wi xor Gi-1 Security문제가 입증됨(Don’t use it)
One-Way Hash Functions Using Symmetric Block Algorithms (6/12) n LOKI Double-Block n n Quisquater-Girault의 변형(LOKI와 함께 동작하도록 설계) Quisquater-Girault에서와 같은 변수를 갖는다. G 0=IG, where IG is a random initial value n H 0=IH, where IH is another random initial value n Wi= ELi xor Gi-1(Gi-1 xor Ri) xor Ri xor Hi-1 n Gi = ERi xor Hi-1(Wi xor Li) xor Gi-1 xor Hi-1 xor Li n Hi = Wi xor Gi-1 n n birthday attack에 약함(Don’t use it)
One-Way Hash Functions Using Symmetric Block Algorithms (7/12) n Parallel Davies-Meyer n block length의 2배의 hash값을 생성하고 hash rate 1을 가지는 알고리즘 n n n G 0=IG, where IG is a random initial value H 0=IH, where IH is another random initial value Gi= ELi xor Ri(Gi-1 xor Li) xor Hi-1 Hi = ELi (Hi-1 xor Ri) xor Ri xor Hi-1 not secure! (Davies-Meyer보다 secure하지 않다. )
One-Way Hash Functions Using Symmetric Block Algorithms (8/12) n Tandem and Abreast Davies-Meyer n two modified Davies-Meyer function work in tandem n n n G 0=IG, where IG is a random initial value H 0=IH, where IH is another random initial value Wi= EGi-1 , M i(Hi-1) Gi = Gi-1 xor EMi , Wi(Gi-1) Hi = Wi xor Hi-1
One-Way Hash Functions Using Symmetric Block Algorithms (9/12) n Two modified Davies-Meyer functions side-byside n n n G 0=IG, where IG is a random initial value H 0=IH, where IH is another random initial value Gi = Gi-1 xor EMi , Hi-1(ㄱGi-1) Hi = Hi xor EGi-1 , Mi(ㄱHi-1) 이 2개의 알고리즘은 security가 좋다.
One-Way Hash Functions Using Symmetric Block Algorithms (10/12) n MDC-2 and MDC-4 n n IBC에서 처음으로 개발 MDC-2 hash rate 1/2 hash 값은 block size의 2배 n MDC-4 hahs rate 1/4 hash값은 block size 현재 compution power에서 안전하지만 평가만큼 안전하지 않다.
One-Way Hash Functions Using Symmetric Block Algorithms (11/12) n AR Hash Function n Algorithmic Research에 의해 개발 information 목적으로 ISO가 배포 CBC mode에서 block 암호화를 기초로 변형 n n Hi=Ek(Mi xor Hi-1 xor Hi-2 xor c) xor Mi 안전하지 못하다. (hash 함수에 대해 collision을 찾기 쉽다. )
One-Way Hash Functions Using Symmetric Block Algorithms (12/12) n GOST Hash Function n GOST block 알고리즘을 사용 64 -bit block size와 256 -bit key을 가지며 출력은 256 bit hash 값을 가짐. Compression function( Hi=f(Mi, Hi-1)) n n 1. 4개 GOST 암호 key를 생성(Mi, Hi-1, constants의 혼 합) 2. ECB mode에서 Hi-1의 64 bits를 암호화하기 위해 각 key를 사용. 결과 256 bit를 S에 저장. 3. Hi는 complex(S, Mi, Hi-1의 함수) Final Hash n H=f(Z xor M`, f(L, f(M`, Hn))) (Hn: 마지막 msg block의 hash, 256
Using Public-Key Algorithms n n One-way hash function으로서 public-key 암호 알 고리즘을 사용 Hash function(M: message , n: prime p와 q의 곱, e: (p-1)(q-1)에 대한 상대적 소수) n n n security n n e의 분산 대수를 찾는 것만큼 어렵다. Problem n n H(M) = Me mod p 여기서 다루고 있는 알고리즘 중에서 가장 느림. Don’t recommend!
Choosing A One-Way Hash Function n Contenders n n SHA, MD 5, constructions based on block ciphers 작자의 choice n SHA MD 5보다 더 긴 hash 값 n 여러 block-cipher보다 빠르다. n NSA에 의해 개발 n
Message Authentication Codes(1/4) n n CBC-MAC Message Authenticator Algorithm(MAA) n n n v=v<<<1 e=v xor w x=((((e+y) mod 232 )v A^C) *(x xor Mi)) mod 232 -1 y=((((e+x)mod 232 )v B^D)*(y xor Mi)) mod 232 -2 Bidirectional MAC Jueneman’s Methods n n quadratic congruential manipulation detection code라고 도 불림. H 0=IH, where IH is the secret key m
Message Authentication Codes(2/4) n RIPE-MAC n n Bart Preneel이 고안 block encryption function으로서 다음 2가지를 사 용 n normal DES(RIPE-MAC 1) triple-DES(RIPE-MAC 3) IBC-Hash n n n security를 증명가능. 모든 msg는 다른 key로 hash되어야만 한다. (단점) function: hi=((Mi mod p) + v) mod 2 n n p: n-bit prime v: random number less than 2 n Mi: padding procedure에 의해 추출된 값.
Message Authentication Codes(3/4) n One-way Hash Function MAC n following constructions seem secure: n n Best approach : n n n H(K 1, H(K 2, M)) H(K, p, M, K), where p pads K to a full message block. 각 메시지 블록에 key의 64 bit를 연결 one-way hash function의 효율성이 떨어진다. Stream Cipher MAC n message stream은 bit generator ki에 의해 2개의 sub-stream으로 demultiplex됨. (secure하지 않다. )
Message Authentication Codes(4/4)
감사합니다.
a6a0f22b1863caf1f9e9b9bb131bbc21.ppt