Cryptographic Hash Function คืออะไร?
ฟังก์ชันทางคณิตศาสตร์ที่ใช้ใน Cryptography รวมความสามารถ Message-passing ของ Hash Functions กับคุณสมบัติ Security
Hash Function ใน Computer Science: ฟังก์ชันบีบอัด String Input ความยาวเท่าไหร่ก็ได้ → String ความยาวคงที่ หากผ่านเงื่อนไขเพิ่มเติม → ใช้ใน Cryptographic Applications ได้ เรียกว่า Cryptographic Hash Functions
บทบาทสำคัญ
เครื่องมือสำคัญที่สุดใน Cryptography ใช้เพื่อ: Authenticity, Digital Signatures, Pseudo Number Generation, Digital Steganography, Digital Time Stamping, ฯลฯ
นิยามทางคณิตศาสตร์
Hash Function f: D → R โดย D = {0,1}* (Binary String ความยาวเปลี่ยนแปลงได้) R = {0,1}ⁿ (n ≥ 1, Binary String ความยาวคงที่) f รับ Message M ขนาดเท่าไหร่ก็ได้ → Fixed-length Hash Result h ขนาด n
Compression Function: Domain D เป็น Finite (Input ความยาวคงที่ → Output สั้นกว่าความยาวคงที่)
คุณสมบัติของ Cryptographic Hash Function
- คำนวณ Hash สำหรับข้อมูลใดๆ ได้ง่ายมาก
- รับ Input Block ขนาดเท่าไหร่ก็ได้
- สร้าง Output ความยาวคงที่
- พฤติกรรมเหมือน Random Function แต่ Deterministic และ Reproducible ได้มีประสิทธิภาพ
- Input ความยาวเท่าไหร่ก็ได้ → Random String ความยาวคงที่
- Input เดียวกัน → Output เดียวกันเสมอ
- ได้ Message M → คำนวณ Digest h ได้ง่าย (Polynomial Time O(n))
- Pre-image Resistance (One-way): ได้ Digest h → หา M ที่ H(M)=h ไม่ได้ในทางปฏิบัติ
- Second Pre-image Resistance (Weak Collision): ได้ M1 → หา M2≠M1 ที่ H(M1)=H(M2) ไม่ได้
- Strong Collision Resistance: หา Pair (M1,M2) ที่ต่างกัน H(M1)=H(M2) ไม่ได้