# 2. Symmetric - Key Cryptography

**URL:** <https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294>\
**Category:** กระดานเนื้อหา 📄\
**Tags:** final-review\
**Created:** [July 25, 2022, 3:06am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294 "2022-07-25T03:06:48Z")\
**Posts on this page:** 12\
**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:** [July 25, 2022, 3:06am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/1 "2022-07-25T03:06:48Z")

</div>

![Cryptography-MD-EP2-1](https://discuss.hashpire.io/uploads/default/original/1X/723caf303653127e6c9a1b45c7e6f7a1a3967c13.png)

 ![Cryptography-MD-EP2-2](https://discuss.hashpire.io/uploads/default/original/1X/08eed648a40cc89593155ef4f477c620a7a02654.png)

 ![Cryptography-MD-EP2-3](https://discuss.hashpire.io/uploads/default/original/1X/73caee361e61217965e31e13f52fb35db4007e14.png)

 ![Cryptography-MD-EP2-4](https://discuss.hashpire.io/uploads/default/original/1X/d3f6e2edfe03d9a91391f9341bff8e7be4580855.png)

 ![Cryptography-MD-EP2-5](https://discuss.hashpire.io/uploads/default/original/1X/b10c17ba3c60965bba0c9bf0b9a6d1eebbba4852.png)

 ![Cryptography-MD-EP2-6](https://discuss.hashpire.io/uploads/default/original/1X/ec4822f40b3aaa8f5c82507672cb01fe836bbb20.png)

 ![Cryptography-MD-EP2-7](https://discuss.hashpire.io/uploads/default/original/1X/a4018dfe00ac9069c9b52b72d8a324f1bdeca675.png)

1. Symmetric - Key Cryptography

Symmetric Key Cryptography คือ รูปแบบการเข้ารหัสแบบกุญแจสมมาตร หรือการเข้ารหัสข้อมูลด้วย “กุญแจเดี่ยว” โดยผู้ส่งและผู้รับจะใช้กุญแจตัวเดียวกันในการเข้าและถอดรหัสข้อมูล ซึ่งวิธีการนี้ผู้รับและผู้ส่งจะต้องตกลงกันก่อนว่าจะใช้อัลกอริทึมใดในการเข้ารหัสข้อมูล และสิ่งที่ผู้รับและผู้ส่งจะต้องมีเช่นเดียวกัน ก็คือ “กุญแจลับ ( Secret Key )” วิธีนี้จะตรงกันข้ามกับการเข้ารหัสแบบกุญแจอสมมาตร ( Public - Key Cryptography ) ที่ใช้กุญแจอันหนึ่งเพื่อเข้ารหัสและใช้กุญแจอีกอันหนึ่งเพื่อถอดรหัส

 ![Symmetric - Key Cryptography](https://discuss.hashpire.io/uploads/default/original/1X/b9398e159f011482daad5f8ef12f36f1681a06e6.png)

โดยหลักการทำงานของ Symmetric Key Cryptography จะประกอบไปด้วย การใช้ข้อความธรรมดา(Plaintext) เป็น Input ผ่านอัลกอริทึมการเข้ารหัส (Encryption Algorithm) ซึ่งเป็นกระบวนการแปลงข้อความธรรมดาให้เป็นข้อความเข้ารหัส (Ciphertext ) เป็น Output ออกมา และ กุญแจลับ ( Secret Key ) เป็นรหัสที่ป้อนเข้าไปในกระบวนการเข้ารหัส ซึ่งรหัสที่ป้อนเข้าไปจะทำให้ผลลัพธ์ที่ได้มีความแตกต่างกันไป แม้ว่าข้อความจะเหมือนกัน ส่วนประกอบสุดท้ายคือ กระบวนการในการถอดรหัส (Decryption Algorithm)

ความปลอดภัยของระบบจะขึ้นอยู่กับความยาวของกุญแจและอัลกอริทึมที่ใช้ในการเข้ารหัส ซึ่งแม้ว่ากุญแจที่ใช้จะมีขนาดเท่ากัน แต่หากใช้อัลกอริทึม คนละตัวกัน ความยากง่ายที่เกิดขึ้นของระบบก็จะไม่เท่ากัน

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

ข้อดี คือ การเข้ารหัสทำได้ง่ายและรวดเร็ว  
ข้อเสีย คือ ต้องการช่องทางในการสื่อสารข้อมูลที่ปลอดภัย (Secure Communication) เนื่องจากการเข้าและถอดรหัสประเภทนี้เป็นแบบ “กุญแจเดี่ยว” ทำให้ต้องมีการส่งกุญแจระหว่างผู้เขาและผู้ถอดรหัส ซึ่งอาจจะเกิดปัญหาได้หากมีบุคคลที่ 3 ที่ไม่หวังดีมาดักฟังกุญแจที่เราใช้ในการเข้ารหัสข้อมูล

อัลกอริทึมการเข้ารหัสแบบกุญแจสมมาตร (Symmetric Key Cryptography ) ถูกนำมาใช้ในระบบคอมพิวเตอร์สมัยใหม่จำนวนมาก เพื่อเพิ่มความปลอดภัยของข้อมูลและความเป็นส่วนตัวของผู้ใช้ เช่น มาตรฐานการเข้ารหัสขั้นสูง (AES) ที่ใช้กันอย่างแพร่หลายทั้งในแอปพลิเคชันการส่งข้อความที่ปลอดภัยและที่เก็บข้อมูลบนคลาวด์ (Cloud Storage)

Reference

> **[Symmetric-key algorithm](https://en.wikipedia.org/wiki/Symmetric-key_algorithm)**
>
> Symmetric-key algorithms\[a\] are algorithms for cryptography that use the same cryptographic keys for both the encryption of plaintext and the decryption of ciphertext. The keys may be identical, or there may be a simple transformation to go between the two keys. The keys, in practice, represent a shared secret between two or more parties that can be used to maintain a private information link. The requirement that both parties have access to the secret key is one of the main drawbacks of sy Symme...

> **[What Is Symmetric Key Cryptography? | Binance Academy](https://academy.binance.com/en/articles/what-is-symmetric-key-cryptography)**
>
> Symmetric key algorithms are widely applied in various types of computer systems to enhance data security. Learn about Symmetric Key Cryptography

* * *

Outline

- Symmetric - Key Cryptography คืออะไร
- กระบวนการทำงานของ Symmetric - Key Cryptography ยกตัวอย่าง
- ตัวอย่างการใช้ Symmetric - Key Cryptography
- ข้อดี-ข้อเสีย

---

<div class="post-metadata">

**Author:** ![parinyar](https://discuss.hashpire.io/user_avatar/discuss.hashpire.io/parinyar/32/127_2.png) [@parinyar](https://discuss.hashpire.io/u/parinyar)\
**Post date:** [July 29, 2022, 3:22am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/2 "2022-07-29T03:22:54Z")

</div>

> [@Namtan](#):
>
> โดย Symmetric Key Cryptography เป็นการเข้ารหัสที่ใช้วิธีการแทนที่ (Substitution) และวิธีย้ายตำแหน่ง (Transposition) ร่วมกัน และมีมาตั้งแต่ในยุคของ Classical Cryptography อย่างเช่น Caesar Cipher ที่เป็นการเข้ารหัสแบบแทนที่ (Substitution) หรือ Scytale ที่เป็นการเข้ารหัสแบบย้ายตำแหน่ง (Transposition) เป็นต้น จนพัฒนามาเป็นอัลกอริธึมที่ใช้กันอย่างแพร่หลายในอินเทอร์เน็ต ในปัจจุบัน เช่น Advanced Encryption Standard (AES) และ Data Encryption Standard (DES)

เสนอให้เปลี่ยนเป็นแบบนี้ครับ  
.  
โดย Symmetric Key Cryptography เป็นการเข้ารหัสที่ใช้วิธีการแทนที่ตัวอักษร (Substitution) และวิธีย้ายตำแหน่งตัวอักษร (Transposition) ร่วมกัน ซึ่ง Substitution และ Transposition มีมานานตั้งแต่ในยุค Classical Cryptography อย่างเช่น Caesar Cipher ที่เป็นการเข้ารหัสแบบ Substitution หรือ Scytale ที่เป็นการเข้ารหัสแบบ Transposition เป็นต้น จนกระทั่งพัฒนามาเป็นอัลกอริธึมที่ใช้กันอย่างแพร่หลายในอินเทอร์เน็ต ในปัจจุบัน เช่น Advanced Encryption Standard (AES) และ Data Encryption Standard (DES)

---

<div class="post-metadata">

**Author:** ![parinyar](https://discuss.hashpire.io/user_avatar/discuss.hashpire.io/parinyar/32/127_2.png) [@parinyar](https://discuss.hashpire.io/u/parinyar)\
**Post date:** [July 29, 2022, 3:28am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/3 "2022-07-29T03:28:24Z")

</div>

> [@Namtan](#):
>
> ในกรณีที่เกิดปัญหาในการทำธุรกรรมขึ้น ดังนั้น โดยทั่วไปในการใช้กุญแจในระบบสมมาตร จึงมักมีการสร้างกุญแจขึ้นแบบสำหรับคนสองคนใช้ร่วมกัน หากมีหลายคน ก็จะต้องใช้กุญแจหลายอัน ถ้าหากเราติดต่อคนจำนวนมาก ก็จะทำให้มีปริมาณกุญแจที่มีมากตามไป จนส่งผลเกิดปัญหาในการบริหารจัดการกุญแจตามมา

ประโยคนี้ลองเกาๆ ดูใหม่ทีครับ ประโยคยังดูแปลกๆ ครับ

> [@Namtan](#):
>
> การเข้ารหัสแบบกุญแจสมมาตร (Symmetric Key Cryptography) นั้นไม่ได้มีส่วนสำคัญใด ๆ ในแอปพลิเคชันที่ใช้ Blockchain แต่อย่างไรก็ตาม การเข้าใจในพื้นฐานของมันจะช่วยให้เราสามารถเข้าใจการเข้ารหัสแบบกุญแจอสมมาตร (Asymmetric - Key Cryptography ) ได้ดีมากยิ่งขึ้น และนอกจากนั้น การเข้ารหัสแบบกุญแจสมมาตร (Symmetric Key Cryptography) มักจะใช้ได้ดีกับการเข้ารหัสจำนวนมาก เพราะว่ามีขนาดกุญแจที่เล็ก หมายความว่าพื้นที่จัดเก็บจะน้อยลงและส่งข้อมูลได้เร็วกว่า ด้วยเหตุนี้ ในบางครั้ง จึงมีการใช้การเข้ารหัสแบบกุญแจอสมมาตร (Asymmetric - Key Cryptography ) ในการแลกเปลี่ยนกุญแจอย่างปลอดภัย หลังจากนั้นจึงใช้การเข้ารหัสแบบกุญแจสมมาตร (Symmetric Key Cryptography)

ประโยคนี้ด้วยครับ ยังดูแปลกๆ ครับ

---

<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:** [August 1, 2022, 5:27am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/4 "2022-08-01T05:27:45Z")

</div>

## Artwork concept

จะทำเป็น story มีทั้งหมด 6 aw

- 
  1. Cover (ยังไม่แน่ใจรูปแบบ)

- 
  1. Symmetric - Key Cryptography คืออะไร (What is it)

- 
  1. การทำงานของ Symmetric - Key Cryptography (How it work)

- 
  1. ข้อดี-ข้อเสีย (Pros & Cons)

- 
  1. สรุป (paragraph สุดท้าย สรุปเกี่ยวกับบทความ)

- 
  1. ending

---

<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:** [August 2, 2022, 2:45am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/5 "2022-08-02T02:45:06Z")

</div>

> [@Namtan](#):
>
> ผู้เข้ารหัสและผู้ถอดรหัสจะต้องใช้กุญแจเดียวกัน ดังนั้น หากมีการใช้กุญแจอันเดียวกับผู้ใช้หลายคน อาจจะเกิดปัญหาในการระบุตัวบุคคลได้ ในกรณีที่เกิดปัญหาในการทำธุรกรรมขึ้น

ปันมองว่าถ้าเราสื่อสารแบบนี้ คนจะเข้าใจปัญหาว่า เมื่อมีการใช้กุญแจหลายอัน จะทำให้เกิดปัญหาในการระบุตัวตน (อันนี้ไม่แน่ใจว่าใช่ปัญหาหลัก ๆ เลยไหมคะ)

ที่ปันลองอ่านคอนเทนต์ด้านล่างเขาระบุปัญหาหลัก ๆ มี 2 อย่าง คือ

1. ปัญหาด้าน key management การจัดการกุญแจทำได้ยากเพราะการเข้าหรัสใยรูปแบบนี้ต้องใช้ 1 key ต่อ 1 คน และเมื่อมีการเข้ารหัสกับคนมากกกว่า 1 คน ทำให้ต้องเก็บกุญแจเพิ่มตามจำนวนคนนั้น ๆ

2. เนื่องจากการเข้าและถอดรหัสประเภทนี้เป็นแบบ “คีย์เดี่ยว” ทำให้ต้องมีการส่งกุญแจดันระหว่างผู้เขาและผู้ถอด ซึ่งอาจทำให้เกิดการขโมยได้ง่าย

ปันเลยไม่แน่ใจว่า ถ้าเราจะยกข้อเสียมาสัก 1 อัน เราควรจะพูดถึงข้อไหนที่เป็น core หลักของ symmentric key จริง ๆ ค่ะ

[https://www.nrca.go.th/content/02-1.html#:~:text=ระบบรหัสแบบสมมาตร%20(Symmetric-key%20Cryptography)%20เป็นระบบ,รูปรหัสคอมพิวเตอร์นี้เป็น](https://www.nrca.go.th/content/02-1.html#:~:text=%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%9A%E0%B8%A3%E0%B8%AB%E0%B8%B1%E0%B8%AA%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%AA%E0%B8%A1%E0%B8%A1%E0%B8%B2%E0%B8%95%E0%B8%A3%20(Symmetric%2Dkey%20Cryptography)%20%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%9A,%E0%B8%A3%E0%B8%B9%E0%B8%9B%E0%B8%A3%E0%B8%AB%E0%B8%B1%E0%B8%AA%E0%B8%84%E0%B8%AD%E0%B8%A1%E0%B8%9E%E0%B8%B4%E0%B8%A7%E0%B9%80%E0%B8%95%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%99%E0%B8%B5%E0%B9%89%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99)

---

<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 2, 2022, 3:01am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/6 "2022-08-02T03:01:20Z")

</div>

เหมือนถ้าปัญหาที่เป็นหลักเห็นหลายๆ ที่หยิบขึ้นมา ส่วนใหญ่น่าจะเป็นปัญหาในการส่งคีย์แล้วจะโดนขโมย อันนี้พี่เจอแทบจะทุกเว็บเลย คิดว่าน่าจะเป็นหลักกว่ามั้ยนะ ถ้าจะเอาแค่เรื่องเดียว

---

<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:** [August 2, 2022, 4:02am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/8 "2022-08-02T04:02:27Z")

</div>

> [@Pantitas](#):
>
> งั้นส่วนตัวปันคิดว่าน่าจะพูดถึงประเด็นนี้ในข้อเสียค่ะดีหว่าค่ะ จะเข้าใจ และเห็นภาพง่ายกว่า

งั้นส่วนตัวปันคิดว่าน่าจะพูดถึงประเด็นนี้ในข้อเสียค่ะดีหว่าค่ะ จะเข้าใจ และเห็นภาพง่ายกว่า

---

<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:** [August 8, 2022, 6:15am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/9 "2022-08-08T06:15:49Z")

</div>

> [@Namtan](#):
>
> รูปแบบในการเข้ารหัสข้อมูลที่ผู้รับกับผู้ส่งตกลงกัน ก็คือ “กุญแจลับ ( Secret Key )”

รูปแบบในการเข้สรหัส น่าจะหมายถึง Algorithm ที่จะใช้ ? Key ไม่น่าถือเป็นรูปแบบ?

> [@Namtan](#):
>
> โดย Symmetric Key Cryptography เป็นการเข้ารหัสที่ใช้วิธีการแทนที่ตัวอักษร (Substitution) และวิธีย้ายตำแหน่งตัวอักษร (Transposition) ร่วมกัน ซึ่ง Substitution และ Transposition มีมานานตั้งแต่ในยุค Classical Cryptography อย่างเช่น Caesar Cipher ที่เป็นการเข้ารหัสแบบ Substitution หรือ Scytale ที่เป็นการเข้ารหัสแบบ Transposition เป็นต้น จนกระทั่งพัฒนามาเป็นอัลกอริทึมที่ใช้กันอย่างแพร่หลายในอินเทอร์เน็ต ในปัจจุบัน เช่น Advanced Encryption Standard (AES) และ Data Encryption Standard (DES)

ไม่ถูกอ่า Caesar Cipher คือ Symmetric Key Encryption  
symmetric ไม่ใช่เกิดขึ้นใน modern crypto  
แค่ symmetric ใน modern crypto มีความ complex + ใช้คอมพิวเตอ  
ยุค Classical Crypto มีแต่ symmetric

> [@Namtan](#):
>
> ข้อดี คือ การเข้ารหัสทำได้ง่ายและรวดเร็ว รวมถึงใช้ได้ดีกับการเข้ารหัสจำนวนมาก เพราะว่ามีขนาดกุญแจที่เล็ก ทำให้ใช้พื้นที่ในการจัดเก็บน้อย

ไม่มีการอธิบายว่าทำไมถึงเล็ก ถ้ามีการอธิบายว่าเล็กควรจะมีอธิบายนะ ไม่งั้นอ่านแล้วก็จะงงๆ  
แล้วมันเล็ก ถ้าเทียบกับอะไร? ที่มันเล็กเพราะมัน compare กับ pubkey crypto

> Asymmetric keys have to be much larger than symmetric keys because 1) there are less asymmetric keys for a given number of bits (key space), and 2) there are patterns within the asymmetric keys themselves.

[https://crypto.stackexchange.com/questions/6236/why-does-the-recommended-key-size-between-symmetric-and-asymmetric-encryption-di](https://crypto.stackexchange.com/questions/6236/why-does-the-recommended-key-size-between-symmetric-and-asymmetric-encryption-di)

> [@Why some cryptographic keys are much smaller than others](https://discuss.hashpire.io/t/why-some-cryptographic-keys-are-much-smaller-than-others/316):
>
> [https://blog.cloudflare.com/why-are-some-keys-small/](https://blog.cloudflare.com/why-are-some-keys-small/)

> [@Namtan](#):
>
> ข้อเสีย คือ ปัญหาด้านความปลอดภัยในการส่งกุญแจ เนื่องจากการเข้าและถอดรหัสประเภทนี้เป็นแบบ “กุญแจเดี่ยว” ทำให้ต้องมีการส่งกุญแจกันระหว่างผู้เขาและผู้ถอดรหัส ซึ่งอาจทำให้เกิดปัญหาการขโมยได้ง่าย

ต้องการช่องทางในการสื่อสารข้อมูลที่ปลอดภัย (Secure Communication)  
Key มันโขมยไม่ได้ มันคือการดักฟัง ? การโขมยคือของของA อยู่ที่ B, A ไม่มีของแล้ว

> [@Namtan](#):
>
> การเข้ารหัสแบบกุญแจสมมาตร นั้นไม่ได้ถือว่ามีส่วนสำคัญใด ๆ ในแอปพลิเคชันที่ใช้ Blockchain มากนัก แต่อย่างไรก็ตาม การเข้าใจในพื้นฐานของการเข้ารหัสแบบกุญแจสมมาตรจะช่วยให้เราสามารถเข้าใจการเข้ารหัสแบบกุญแจอสมมาตร ( Public - Key Cryptography ) ได้ดีมากยิ่งขึ้น

ไม่ค่อยถูก  
“ในแอปพลิเคชันที่ใช้ Blockchain” หมายถึงอะไร App ที่ใช้ blockchain ทำ ? หมายถึง Smart Contract?  
“การเข้าใจในพื้นฐานของการเข้ารหัสแบบกุญแจสมมาตรจะช่วยให้เราสามารถเข้าใจการเข้ารหัสแบบกุญแจอสมมาตร ( Public - Key Cryptography ) ได้ดีมากยิ่งขึ้น” ช่วยยังไง ?

---

<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:** [August 8, 2022, 6:22am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/10 "2022-08-08T06:22:43Z")

</div>

> [@Namtan](#):
>
> Symmetric Key Cryptography หรือที่รู้จักในชื่อ Symmetric Encryption

@Pantitas ในกราฟฟิก ไม่จำเป็นต้องมีพวกอีกชื่ออะไรงี้นะ มันจะทำให้ text บน กราฟฟิกยาว และไม่ได้ใจความ กินพื้นที่  
และมันมีหลายชื่อมาก ส่วนตัวไม่ค่อยเรียก Symmetric Encryption จะเรียกเป็น Symmetric Key Encryption

ชื่อหลักที่เราจะใช้เรียก ควรจะสอดคล้องกับบทความอื่นๆ

- public key cryptography, symmetric encryption
- secret key cryptography( private key cryptography), asymmetric encryption

---

<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:** [August 9, 2022, 9:53am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/11 "2022-08-09T09:53:49Z")

</div>

> [@Namtan](#):
>
> ซึ่งอัลกอริทึมในการเข้ารหัสข้อมูลที่ผู้รับและผู้ส่งตกลงกัน ก็คือ “กุญแจลับ ( Secret Key )”

คียไม่ใช่ algorithm  
1 Key สามารถใช้ได้กับหลายๆ algorithm

---

<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:** [August 9, 2022, 9:59am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/12 "2022-08-09T09:59:28Z")

</div>

> [@Namtan](#):
>
> ความปลอดภัยของระบบจะขึ้นอยู่กับความยากในการสุ่มกุญแจ ยิ่งกุญแจที่ใช้ในการเข้ารหัสมีความยาวเท่าไร การถอดรหัสก็ยิ่งทำได้ยากขึ้นเท่านั้น เช่น กุญแจที่มีความยาว 256 บิตโดยทั่วไปถือว่ามีความปลอดภัยสูงและทนทานต่อการโจมตีได้ดี

ความยาว key คือส่วนหนึ่ง ขึ้นอยู่ที่ algorithm ด้วย  
key เท่ากัน คนละ algorithm ความยากไม่เท่ากัน

---

<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:** [August 10, 2022, 2:46am UTC](https://discuss.hashpire.io/t/2-symmetric-key-cryptography/294/13 "2022-08-10T02:46:04Z")

</div>

> **Security of symmetric ciphers**  
> Symmetric ciphers have historically been susceptible to [known-plaintext attacks](https://en.wikipedia.org/wiki/Known-plaintext_attack), [chosen-plaintext attacks](https://en.wikipedia.org/wiki/Chosen-plaintext_attack), [differential cryptanalysis](https://en.wikipedia.org/wiki/Differential_cryptanalysis) and [linear cryptanalysis](https://en.wikipedia.org/wiki/Linear_cryptanalysis). Careful construction of the functions for each round can greatly reduce the chances of a successful attack.[_[citation needed](https://en.wikipedia.org/wiki/Wikipedia:Citation_needed)_ ] It is also possible to increase the key length or the rounds in the encryption process to better protect against attack. This, however, tends to increase the processing power and decrease the speed at which the process runs due to the amount of operations the system needs to do.[[11]](https://en.wikipedia.org/wiki/Symmetric-key_algorithm#cite_note-12)
