Encoding is not encryption · การเข้ารหัสไม่ใช่การเข้ารหัสลับ
A common mix-up
- People often say "encoded" when they mean "encrypted". They are not the same.
- Encoding changes the format of data so it can be stored or sent — it is not secret.
- Encryption changes data so that only someone with the key can read it — it is secret.
ความเข้าใจผิดที่พบบ่อย
- คนมัก会说 "encoded" เมื่อต้องการจะพูดว่า "encrypted"但它们 ไม่ใช่สิ่งเดียวกัน
- การแปลงรูปแบบ (Encoding) เปลี่ยน รูปแบบ ของข้อมูลเพื่อให้จัดเก็บหรือส่งได้ — มัน ไม่ใช่ความลับ
- การเข้ารหัส (Encryption) เปลี่ยนข้อมูลเพื่อให้มีเพียงผู้ที่มี กุญแจ เท่านั้นที่อ่านได้ — มัน เป็นความลับ
Base64 — a famous encoding
- Base64 rewrites bytes using 64 safe characters. It is used to put images or files inside text (like email).
- Anyone can decode it — no key needed. So base64 hides nothing.
Base64 — การแปลงรูปแบบที่มีชื่อเสียง
- Base64 เขียน byte ใหม่โดยใช้ 64 ตัวอักษรที่ปลอดภัย มักใช้ใส่ภาพหรือไฟล์ลงในข้อความ (เช่น อีเมล)
import base64
secret = base64.b64encode(b"hello").decode()
print(secret) # aGVsbG8=
print(base64.b64decode(secret).decode()) # back to hello
- ใครก็ตามสามารถถอดรหัสได้ — ไม่ต้องใช้กุญแจ ดังนั้น base64 จึงไม่ซ่อนอะไรเลย
Why this matters for security
- If a website "protects" your password with base64, it is not protected at all.
- Real protection needs encryption (with a key) or hashing (one-way). Encoding is just a costume.
ทำไมสิ่งนี้ถึงสำคัญต่อความปลอดภัย
- หากเว็บไซต์ "ปกป้อง" รหัสผ่านของคุณด้วย base64 มัน ไม่ได้被protectedเลย
- การปกป้องที่แท้จริงต้องใช้ การเข้ารหัส (ด้วยกุญแจ) หรือ การแฮช (ทางเดียว) การแปลงรูปแบบเป็นเพียงเครื่องแต่งกาย
Try it
- Encode
helloto base64 below. Then imagine decoding it — and remember it is not a secret.
Covers: foundation for IGCSE 2.3 / A-Level 17.1 (encryption).
ลองดูกัน
- แปลง
helloเป็น base64 ด้านล่างจากนั้นลองคิดถึงการถอดรหัส — และจำไว้ว่ามันไม่ใช่ความลับ
ครอบคลุม: พื้นฐานสำหรับ IGCSE 2.3 / A-Level 17.1 (การเข้ารหัส).
Common mistakes
- Base64 is encoding — anyone can reverse it, so it gives no security.
- Encoding changes the format; encryption protects the content.
ข้อผิดพลาดที่พบบ่อย
- Base64 คือการแปลงรูปแบบ — ใครก็สามารถย้อนกลับได้ จึงไม่ให้ความปลอดภัยanything
- การแปลงรูปแบบเปลี่ยนรูปแบบ; การเข้ารหัสปกป้องเนื้อหา
Use base64 to encode the word hello. Encode its bytes and print the result as text. (Notice: anyone can decode it — encoding is not secret.) · ใช้ base64 เพื่อ encode คำว่า hello. Encode bytes ของมันและ print ผลลัพธ์เป็นตัวอักษร. (สังเกต: ใครก็ตามสามารถ decode ได้ — encoding ไม่ใช่ ความลับ)
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่
An app 'protected' a message as base64 — prove that protects nothing. Decode captured with base64.b64decode and print the text. No key needed. · แอป 'ปกป้อง' ข้อความเป็น base64 —พิสูจน์ว่า保护的nothing. Decode captured ด้วย base64.b64decode และพิมพ์ข้อความ. ไม่ต้องใช้คีย์
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่