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.

Base64 — a famous encoding
- Base64 rewrites bytes using 64 safe characters. It is used to put images or files inside text (like email).
import base64
secret = base64.b64encode(b"hello").decode()
print(secret) # aGVsbG8=
print(base64.b64decode(secret).decode()) # back to hello
- Anyone can decode it — no key needed. So base64 hides nothing.
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.
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).
Common mistakes
- Base64 is encoding — anyone can reverse it, so it gives no security.
- Encoding changes the format; encryption protects the content.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
사용법 base64 to encode the word hello. Encode its bytes and print the result as text. (Notice: anyone can decode it — encoding is 아니 secret.)
출력을 보려면 '실행'을 클릭하세요.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
An app 'protected' a message as base64 — prove that protects nothing. Decode captured with base64.b64decode and print the text. No key needed.
출력을 보려면 '실행'을 클릭하세요.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
A site should store a 해시 of your password, never the password or its base64. Write check_login(attempt, stored), which returns True when the SHA-256 hash of attempt (as hex text) equals stored. Use hashlib.sha256(attempt.encode()).hexdigest(). (This check leaves out the salt and slow hash of lesson 07 to stay short.)
출력을 보려면 '실행'을 클릭하세요.