Symmetric encryption · Enkripsi simetris
Locking with a key
- Encryption scrambles a message so only someone with the key can read it.
- In symmetric encryption, the same key locks and unlocks. Sender and receiver must both know it.
Mengunci dengan kunci
- Enkripsi mengacak pesan sehingga hanya seseorang yang memiliki kunci yang bisa membacanya.
- Dalam enkripsi simetris, kunci yang sama mengunci dan membuka. Pengirim dan penerima harus keduanya mengetahuinya.
The Caesar cipher
- The oldest example: shift every letter forward by a fixed number. With shift 3,
a → d,b → e, and so on. - The key is the shift. Decrypting just shifts back.
Cipher Caesar
- Contoh tertua: geser setiap huruf maju sejumlah tetap. Dengan pergeseran 3,
a → d,b → e, dan seterusnya. - Kunci adalah geserannya. Mendekripsi hanya menggeser kembali.
text = "attack"
shift = 3
out = "".join(chr((ord(c) - 97 + shift) % 26 + 97) for c in text)
print(out) # dwwdfn
Why Caesar is weak
- There are only 25 possible shifts, so a computer can try them all in a blink.
- This is a brute-force attack on the key — exactly what real encryption must resist.
Mengapa Caesar lemah
- Hanya ada 25 kemungkinan geseran, sehingga komputer dapat mencobanya semua dalam kedipan mata.
- Ini adalah serangan brute-force pada kunci — persis seperti yang harus dilawan oleh enkripsi nyata.
What real ciphers do
- Modern symmetric ciphers like AES use keys with billions of billions of possibilities.
- The big problem they leave: how do two people share the secret key safely? The next lesson solves it.
Covers: IGCSE 2.3 (symmetric encryption), A-Level 17.1.
Apa cipher nyata lakukan
- Cipher simetris modern seperti AES menggunakan kunci dengan miliaran miliaran kemungkinan.
- Masalah besar yang mereka tinggalkan: bagaimana dua orang berbagi kunci rahasia dengan aman? Pelajaran berikutnya menyelesaikannya.
Mencakup: IGCSE 2.3 (enkripsi simetris), A-Level 17.1.
Common mistakes
- One shared key both encrypts and decrypts.
- The hard part is sharing that key safely.
Kesalahan umum
- Satu kunci bersama mengenkripsi dan mendekripsi.
- Bagian yang sulit adalah membagikan kunci tersebut dengan aman.
Symmetric encryption · Enkripsi simetris
The Caesar cipher uses one shared key to encrypt and decrypt. · Caesar cipher menggunakan satu kunci bersama untuk mengenkripsi dan mendekripsi.
Encrypt hello with a Caesar cipher: shift each letter forward by shift places (wrapping past z back to a). Build the encrypted string and print it. · Enkripsi hello dengan Caesar cipher: geser setiap huruf maju sebanyak shift tempat (berpaling melewati z kembali ke a). Bangun string terenkripsi dan cetak.
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.
Now break it — that is why Caesar is weak. You intercepted cipher, and you suspect the plaintext is attack. Try every shift from 1 to 25, shifting back, and print the shift that turns cipher into attack. · Sekarang pecahkan — itulah sebabnya Caesar lemah. Anda menyadap cipher, dan Anda curiga plaintext adalah attack. Cobalah setiap pergeseran dari 1 hingga 25, geser mundur, dan cetak pergeseran yang mengubah cipher menjadi attack.
Click Run to see the output here. · Klik Jalankan untuk melihat output di sini.