480 likes | 811 Views
boonrit@feu.ac.th. Block Cipher Principles. Stream Ciphers and Block Ciphers. stream cipher A symmetric encryption algorithm in which ciphertext output is produced bit-by-bit or byte-by-byte from a stream of plaintext input. block cipher
E N D
boonrit@feu.ac.th Block Cipher Principles
Stream Ciphers and Block Ciphers stream cipher A symmetric encryption algorithm in which ciphertext output is produced bit-by-bit or byte-by-byte from a stream of plaintext input. block cipher A symmetric encryption algorithm in which a block of plaintext bits (typically 64 or 128) is transformed as a whole into a ciphertext block of the same length.
Stream cipher เป็นวิธีการเข้ารหัสที่ละตัว Key This is a Message Encryption EWRKLIH……..
Stream cipher ข้อดีของ stream cipher ความเร็วในการเข้ารหัสและถอดรหัส ความผิดพลาดต่ำ ข้อเสียของ stream cipher เกิดการซ้ำกันของตัวอักษร ง่ายต่อการวิเคราะห์ ง่ายต่อการเปลี่ยนแปลงแก้ไขข้อมูล เช่นจำนวนเงิน
Block cipher เป็นการเข้ารหัสแบบกลุ่ม ทำการแบ่งข้อมูลออกเป็น block แล้วนำไปเข้ารหัส Key This is a Message Encryption EWRKLIH…….. This is a Me sage
Block cipher ข้อดีของ Block cipher การกระจายความซ้ำกันของตัวอักษร ต่อต้านการดัดแปลงต่อเติมข้อมูลใด้ ข้อเสียของ Block cipher ใช้เวลาในการเข้ารหัสนานกว่า มีการเกิดความผิดพลาดต่อเนื่อง
Characteristics of good Cipher ความปลอดภัยของการเข้ารหัสแปรผันตรงกับความยากของการเข้ารหัส ไม่ควรมีข้อจำกัดของการเลือกใช้กุญแจเข้ารหัส กระบวนการนำวิธีการเข้ารหัสไปใช้ต้องสะดวกและง่าย ความผิดพลาดที่จุดใดจุดหนึ่งต้องไม่ขยายไปสู่ส่วนอื่นๆ Cipher text ต้องมีขนาดไม่ใหญ่กว่า Plaintext
Secret key Encryption การเข้ารหัสที่ใช้กุญแจเข้ารหัสและกุญแจถอดรหัสตัวเดียวกัน KeyA KeyB Ciphertext Plaintext Plaintext Encryption Decryption KeyA=KeyB
Secret key Encryption DES(Data Encryption Standard) เข้ารหัสแบบ Block Cipher พัฒนาโดย US Federa Standard Key size >58 Bit ความเร็วในการเข้าและถอดรหัส
Secret key Encryption Triple DES พัฒนาต่อจาก DES มีความปลอดภัยมากกว่า DES Keyขนาดมากกว่า DES AES(Advanced Encryption Standard) มีความปลอดภัยในการเข้าและถอดรหัสมากกว่า DES
Secret key Encryption ข้อดีของ Secret key การเข้ารหัสและถอดรหัสทำได้เร็ว วิธีการพัฒนาการเข้ารหัสและถอดรหัสทำให้ง่าย ข้อเสียของ Secret key การกระจายกุญแจทำได้ยาก มีโอกาสที่จะถูกขโมยกุญแจในการขั้นตอนการส่งกุญแจ
Public key Encryption การเข้ารหัสที่ใช้กุญแจเข้ารหัสและกุญแจถอดรหัสคนละตัวเดียวกัน KeyA KeyB Ciphertext Plaintext Plaintext Encryption Decryption KeyA<>KeyB
Public key Encryption RSA พัฒนาโดย Rivest,Shamir,Adleman Key>1028 Bit กุญแจเข้ารหัสและถอดรหัสคนละตัว
Public key Encryption ข้อดีของ Public key การกระจายกุญแจทำได้ง่าย การขโมยกุญแจในการขั้นตอนการส่งกุญแจไม่มีผลต่อการถอดรหัส ข้อเสียของ Public key การเข้ารหัสและถอดรหัสทำได้ช้า ไม่เหมาะในการเข้ารหัสที่มีข้อมูลที่มีขนาดใหญ่
DES เบื้องต้น P10 Shift IP-1 IP P8 fk fK Shift SW SW P8 fK fk IP IP-1 10 bit key 8 bit plaintext 8 bit plaintext 8 bit ciphertext 8 bit ciphertext
DES เบื้องต้น S-DES Key Generation ประกอบด้วย P10 Shift P8
DES เบื้องต้น P10(Permutation) ทำหน้าที่ สลับและเปลี่ยนตำแหน่งบิท P10(k1,k2,k3,k4,k5,k6,k7,k8,k9,k10)=(k3,k5,k2,k7,k4,k10,k1,k9,k8,k6) P10 3 5 2 7 4 10 1 9 8 6 P10 1101101001 0111111000
DES เบื้องต้น Shift ทำการเลื่อนบิทไปทางซ้าย 5 bit 5 bit LeftShift 1 LeftShift 1 5 bit 5 bit LeftShift 10000 01100 00001 11000
DES เบื้องต้น P8(Permutation) ทำหน้าที่ สลับและเปลี่ยนตำแหน่งบิทและลดขนาดของ บิท ลงเหลือ 8 บิท P8 6 3 7 4 8 5 10 9 P8 00100 00011 01000011
The Function fK fK(L,R)=(LF(R,SK),R)
E/P(Expansion/permutation) ทำหน้าที่ ขยายบิทและสลับตำแหน่งบิทใหม่ E/P 4 1 2 3 2 3 4 1 1001 11000011 E/P
S-box ลดขนาดบิท x x x x P0 P1 P2 P3 0111 P0=0,P1=1,P2=1,P3=1
S-box P0,3 P0,3 0 1 2 3 0 0 1 2 3 1 2 0 1 3 2 3 0 1 0 3 2 1 0 3 0 1 2 3 0 1 0 3 2 1 3 2 1 0 2 0 2 1 3 3 3 1 3 2 P1,2 P1,2 S1= S0= S0 11 0100
P4(Permutation) ทำหน้าที่ สลับและเปลี่ยนตำแหน่งบิท P4 2 4 3 1 1001 0101 P4
The switch Function ทำหน้าที่สลับ 4Bit บน กับ 4 Bit ล่าง switch 01101001 10010110
IP(Initial Permutation) เป็นการเอาข้อมูลมาสลับบิทก่อน IP(x) IP 2 6 3 1 4 8 5 7 00101101 00110011 IP
IP-1 (Inverse Permutation) สลับบิทข้อมูลกลับ IP-1(IP(X))=X IP-1 4 1 3 5 7 2 8 6 00101101 IP-1 01100110
General n-bit-n-bit Block Substitution (shown with n = 4) Plaintext Ciphertext 0000 1110 0001 0100 0010 1101 0011 0001 0100 0010 0101 1111 0110 1011 0111 1000 1000 0011 1001 1010 1010 0110 1011 1100 1100 0101 1101 1001 1110 0000 1111 0111
The Data Encryption Standard DES Encryption
โดยการสลับ และแปลงข้อมูล 6 บิทเหลือ 4 บิท 1 2 3 4 5 6 S Bit 1,6 เลือก Row Bit 2,3,4,5 เลือก Column
ข้อมูล 110010 เข้า S1 10 = Row 2 1001=Column 9 เปิดตาราง S1 110010 S1 1100 (12)