Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> การเขียนโปรแกรม

Polyalphabetic Substitution Cipher ในความปลอดภัยข้อมูลคืออะไร?

Polyalphabetic Substitution Cipher

ไซเฟอร์แทนที่ที่ใช้ หลาย Alphabets (หลาย Mapping) สลับกันใช้ ตำแหน่งของตัวอักษรในข้อความกำหนด Alphabet ที่ใช้

หลักการทำงาน

  • แทนที่ Monoalphabetic: 1 Plaintext Letter → 1 Ciphertext Letter (คงที่)
  • Polyalphabetic: 1 Plaintext Letter → หลาย Ciphertext Letters (ขึ้นกับตำแหน่ง)
  • ซ่อน Frequency Distribution ของภาษา → ทน Frequency Analysis

ประวัติศาสตร์

  • Alberti Cipher (1467): Leon Battista Alberti, ใช้ Cipher Disk สลับ Alphabet ด้วยตัวใหญ่ใน Ciphertext
  • Vigenère Cipher (1586): Blaise de Vigenère, ยอดนิยมนาน 300 ปี "Le Chiffre Indéchiffrable"

Vigenère Cipher (ตัวอย่างยอดนิยม)

การเข้ารหัส

  • Keyword: 如 "KEY" → K E Y K E Y K E Y... (ซ้ำจนครบความยาว Plaintext)
  • แต่ละตัวอักษร Keyword ให้ Shift Value (A=0, B=1, ..., Z=25)
  • Cᵢ = (Pᵢ + Kᵢ) mod 26

Vigenère Square (Tabula Recta)

ตาราง 26×26 แถว = Shift (Key), คอลัมน์ = Plaintext, เซลล์ = Ciphertext

ตัวอย่าง

Plaintext: ATTACKATDAWN
Keyword: LEMONLEMONLE
Ciphertext: LXFOPVEFRNHR

การโจมตี Vigenère

  • Kasiski Examination (1863): หาความยาว Keyword จาก Repeated Sequences
  • Friedman Test (Index of Coincidence): ประมาณความยาว Keyword ทางสถิติ
  • Frequency Analysis ต่อ Column: แยก Ciphertext เป็น Columns ตามความยาว Keyword → แต่ละ Column เป็น Monoalphabetic → แตกได้

สเตกาโนกราฟีสมัยใหม่ (Modern Stream Ciphers)

Polyalphabetic Cipher สมัยใหม่ = Stream Cipher

  • Keystream Generator: สร้าง Keystream จาก Key + IV (Nonce)
  • Ciphertext = Plaintext ⊕ Keystream
  • ตัวอย่าง: ChaCha20, AES-CTR, AES-GCM
  • ต้องการ: Keystream ไม่ซ้ำ (Unique Nonce/IV ต่อ Key)

สรุป

Polyalphabetic แก้ปัญหา Frequency Analysis ของ Monoalphabetic แต่ Vigenère แตกได้ด้วย Kasiski/Friedman Stream Ciphers สมัยใหม่ (ChaCha20, AES-CTR) เป็น Polyalphabetic ที่ปลอดภัยจริง (ถ้าใช้ Nonce ถูกต้อง)