# Block Cipher VS Stream Cipher

**URL:** <https://discuss.hashpire.io/t/block-cipher-vs-stream-cipher/386>\
**Category:** Content Board\
**Tags:** beginner, article\
**Created:** [August 25, 2022, 7:28am UTC](https://discuss.hashpire.io/t/block-cipher-vs-stream-cipher/386 "2022-08-25T07:28:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Namtan](https://discuss.hashpire.io/user_avatar/discuss.hashpire.io/namtan/32/23_2.png) [@Namtan](https://discuss.hashpire.io/u/Namtan)\
**Post date:** [August 25, 2022, 7:28am UTC](https://discuss.hashpire.io/t/block-cipher-vs-stream-cipher/386/1 "2022-08-25T07:28:13Z")

</div>

# Planning

## Text

### ชื่อหัวข้อที่จะนำเสนอ

- Block Cipher VS Stream Cipher

### โครงสร้างของเนื้อหา

1. จำนวนหัวข้อทั้งหมดที่จะนำเสนอ
  - 1 หัวข้อ

2. แต่ละหัวข้อจะนำเสนออะไร
  - หัวข้อที่ 1 : อธิบายความแตกต่างระหว่าง Block Cipher และ Stream Cipher ในด้านของกระบวนการทำงาน
  - Reference : จากที่พี่ต้าอธิบายใน Discord

### ประเด็นสำคัญของบทความ

- อธิบายความแตกต่างระหว่าง Block Cipher และ Stream Cipher ในด้านของกระบวนการทำงาน

### สิ่งที่ผู้อ่านจะได้รับจากบทความ

- เห็นความแตกต่างด้านของกระบวนการทำงานของ Block Cipher และ Stream Cipher

## Graphic

### เสนอไอเดียสำหรับออกแบบกราฟฟิค

### รูปแบบของกราฟฟิคที่จะนำเสนอ

### โครงสร้างของกราฟฟิค

1. จำนวน Page ที่จะนำเสนอ
  - …รูป

2. แต่ละ Page เป็นรูปแบบอย่างไร
  - รูปที่ 1 :
  - รูปที่ 2 :
  - รูปที่ 3 :

คำถามที่รบกวนให้ Reviewer ช่วยตอบค่ะ

#### 1. ต้องการรู้ประเด็นไหนเพิ่มเติมไหม เพราะอะไร

#### 2. คิดว่าเรียงลำดับการนำเสนอได้ดีรึยัง ถ้าไม่ดี มีไอเดียอย่างไร

#### 3. มีประเด็นไหนควรตัดทิ้งไหม เพราะอะไร

# 📝 Content text + graphic

 ![Block-Cipher-VS-Stream-Cipher-1](https://discuss.hashpire.io/uploads/default/original/2X/8/888224cf598f838cde11faa90e8ec814331ef271.png)

 ![Block-Cipher-VS-Stream-Cipher-2](https://discuss.hashpire.io/uploads/default/original/2X/f/f2a745575bf6dde2ae5d09a800a82cf909107f13.png)

 ![Block-Cipher-VS-Stream-Cipher-3](https://discuss.hashpire.io/uploads/default/original/2X/2/209ff5d582493e2883bf8d821f7ec5b926fe5023.png)

 ![Block-Cipher-VS-Stream-Cipher-4](https://discuss.hashpire.io/uploads/default/original/2X/2/2f01d77759878347fc8a7c48300e8f32642959ed.png)

 ![Block-Cipher-VS-Stream-Cipher-5](https://discuss.hashpire.io/uploads/default/original/2X/0/03dade3a245e6bf99c0d6e5af7a5850c3e28cb96.png)

 ![Block-Cipher-VS-Stream-Cipher-6](https://discuss.hashpire.io/uploads/default/original/2X/b/bb9355f3d4087bbe4e5515921d7c83c810e56aa2.png)

 ![Block-Cipher-VS-Stream-Cipher-7](https://discuss.hashpire.io/uploads/default/original/2X/5/51e5a58b853d0ba61487c570a9e5640b90ca0738.png)

Block Cipher VS Stream Cipher  
จากบทความก่อนหน้านี้ที่เราได้นำเสนอเกี่ยวกับ Block Cipher และ Stream Cipher กันไปแล้ว มาในบทความนี้ เราจะมาเปรียบเทียบให้เห็นถึงความแตกต่างของทั้ง 2 วิธี ที่แม้ว่าจะเป็นการเข้ารหัสแบบ Symmetric - Key Cryptography (ใช้คีย์เดียวในการเข้าและถอดรหัส) เช่นเดียวกัน แต่ในด้านอื่น ๆ นั้นมีความแตกต่างกันค่อนข้างมาก

การเข้าและถอดรหัสของ Block Cipher จะทำเป็นบล็อกที่มีขนาดคงที่ ข้อความที่จะเข้ารหัสต้องมีขนาดพอดีกับบล็อก จึงจะทำการเข้ารหัสได้ ดังนั้นจึงต้องมีกระบวนการ Padding ซึ่งเป็นการเพิ่มความยาวของข้อความให้พอดีกับขนาดของบล็อกเข้ามาด้วย ส่งผลให้ความเร็วในการเข้ารหัสของ Block Cipher นั้นช้ากว่า Stream Cipher และทำให้ Output ที่ได้มีโอกาสที่จะใหญ่กว่า Input

ในขณะที่ Stream Cipher จะเข้ารหัสและถอดรหัสที่ละบิตหรือไบต์เรียงต่อกันไปเรื่อย ๆ ไม่จำเป็นต้องมีการ Padding ทำให้มีความรวดเร็วในการเข้ารหัสมากกว่า Block Cipher และ Output ที่ได้จะมีขนาดเท่ากับ Input เสมอ นอกจากนั้นในการใช้คีย์ แม้ว่าจะใช้คีย์เดียวเหมือนกัน แต่ว่า Block Cipher นั้น 1 คีย์สามารถใช้ซ้ำได้หลายครั้ง ส่วน Stream Cipher 1 คีย์สามารถใช้ได้ครั้งเดียว

| ความแตกต่าง | Block Cipher | Stream Cipher |
| --- | --- | --- |
| กระบวนการเข้ารหัส | ทำเป็นบล็อกที่มีขนาดคงที่ มีกระบวนการ Padding ซึ่งเป็นการเพิ่มความยาวของข้อความให้พอดีกับขนาดของบล็อก | เข้ารหัสที่เข้ารหัสทีละบิตหรือไบต์เรียงต่อกันไปเรื่อย ๆ |
| กระบวนการถอดรหัส | ทำแบบบล็อกต่อบล็อก | ทำทีละบิต |
| ความเร็ว | ช้ากว่า Stream Cipher | เร็วกว่า Block Cipher |
| การใช้คีย์ | 1 คีย์สามารถใช้ซ้ำได้หลายครั้ง | 1 คีย์สามารถใช้ได้ครั้งเดียว |
| ผลลัพธ์ | มีโอกาสที่ Output จะมีขนาดใหญ่กว่า Input | Output จะมีขนาดเท่ากับ Input เสมอ |
| ตัวอย่าง | DES (Data Encryption Standard) | Rivest Cipher (RC4) |

# Reference

> [@Difference between Block Cipher and Stream Cipher - GeeksforGeeks](https://discuss.hashpire.io/t/difference-between-block-cipher-and-stream-cipher-geeksforgeeks/524):
>

> [@Stream Cipher vs Block Cipher | Find the Top 11 Comparison & Key Points](https://discuss.hashpire.io/t/stream-cipher-vs-block-cipher-find-the-top-11-comparison-key-points/525):
>

---

<div class="post-metadata">

**Author:** ![supanut](https://discuss.hashpire.io/user_avatar/discuss.hashpire.io/supanut/32/22_2.png) [@supanut](https://discuss.hashpire.io/u/supanut)\
**Post date:** [August 26, 2022, 9:41am UTC](https://discuss.hashpire.io/t/block-cipher-vs-stream-cipher/386/2 "2022-08-26T09:41:22Z")

</div>

คำถามที่รบกวนให้ Reviewer ช่วยตอบค่ะ

1. อธิบายลึกกว่านี้หน่อยครับ จะชูความแตกต่างด้านใดบ้าง จะอธิบายในมุมไหนบ้าง

---

<div class="post-metadata">

**Author:** ![supanut](https://discuss.hashpire.io/user_avatar/discuss.hashpire.io/supanut/32/22_2.png) [@supanut](https://discuss.hashpire.io/u/supanut)\
**Post date:** [October 28, 2022, 7:44am UTC](https://discuss.hashpire.io/t/block-cipher-vs-stream-cipher/386/3 "2022-10-28T07:44:54Z")

</div>

> [@Namtan](#):
>
> พอดีกับขนาดของบล็อก ในกรณีที่ข้อความธรรมดามีขนาดไม่เท่ากับขนาดของบล็อก

- ตรงนี้ไม่ควรเว้นวรรคอ่านแล้วทำให้งงไม่ต่อเนื่องครับ

---

<div class="post-metadata">

**Author:** ![supanut](https://discuss.hashpire.io/user_avatar/discuss.hashpire.io/supanut/32/22_2.png) [@supanut](https://discuss.hashpire.io/u/supanut)\
**Post date:** [November 7, 2022, 11:24am UTC](https://discuss.hashpire.io/t/block-cipher-vs-stream-cipher/386/4 "2022-11-07T11:24:56Z")

</div>

@Namtan เพิ่มคำอธิบายอีกนิด

- Stream Cipher เป็น… และไม่มีการทำ padding ดังนั้นขนาดของ output จะเท่ากับ input
- ส่วน Block Cipher มีโอกาสที่ output จะใหญ่กว่า input เพราะเจอ padding กรณีที่ขนาดข้อมูลหารออกมาแล้วไม่ลงตัวเท่ากับขนาด block

---

<div class="post-metadata">

**Author:** ![Pantitas](https://discuss.hashpire.io/user_avatar/discuss.hashpire.io/pantitas/32/4_2.png) [@Pantitas](https://discuss.hashpire.io/u/Pantitas)\
**Post date:** [November 16, 2022, 7:23am UTC](https://discuss.hashpire.io/t/block-cipher-vs-stream-cipher/386/5 "2022-11-16T07:23:27Z")

</div>

@Namtan ลิงค์นี้เกี่ยวกับเปรียบเทียบ คิดว่ามีประเด็นนี้อีกหนึ่งอันที่น่าพูดถึงนะคะ

 ![Screen Shot 2565-11-16 at 14.22.25](https://discuss.hashpire.io/uploads/default/original/2X/f/f3e33eac308e1fa12a217bbd19698164e39059c6.jpeg)  
 ![Screen Shot 2565-11-16 at 14.22.34](https://discuss.hashpire.io/uploads/default/original/2X/a/a5ed7fbc4f6ce2bbe80f1385782b221fcf046b9c.png)

อย่าง stream cipher ยกตัวอย่างเป็น OTP ก็ดูใกล้ตัวดีนะคะ

> **[Stream Cipher vs Block Cipher | Find the Top 11 Comparison & Key Points](https://www.educba.com/stream-cipher-vs-block-cipher/)**
>
> Guide to Stream Cipher vs Block Cipher. Here we also discuss Stream Cipher vs Block Cipher key differences and comparison table.

---

<div class="post-metadata">

**Author:** ![anakornk](https://discuss.hashpire.io/user_avatar/discuss.hashpire.io/anakornk/32/3_2.png) [@anakornk](https://discuss.hashpire.io/u/anakornk)\
**Post date:** [November 23, 2022, 8:29am UTC](https://discuss.hashpire.io/t/block-cipher-vs-stream-cipher/386/6 "2022-11-23T08:29:09Z")

</div>

![basic-block-cipher](https://discuss.hashpire.io/uploads/default/original/2X/a/a84252b263a87d618942408ab74b2230a9c99d82.png)  
 ![block-cipher-chaining-operation](https://discuss.hashpire.io/uploads/default/original/2X/e/ea03a568a83ed3e2c0fed9526b843883a2627fba.png)  
 ![how-a-stream-cipher-works](https://discuss.hashpire.io/uploads/default/original/2X/a/ab829aa4f82b019f933f46b15044de719d15b365.png)
