Symmetric encryption · הצפנה סימטרית
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.
נעילה עם מפתח
- הצפנה מערבלת הודעה כך שרק מי שמחזיק ב-מפתח יוכל לקרוא אותה.
- בהצפנה סימטרית, אותו מפתח נעול ופותח. לשלוח ולקבל יש לדעת אותו.
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.
ציפר Caesar
- הדוגמה הישנה ביותר: הזזת כל אות קדימה באותו מספר. בהזזה של 3,
a → d,b → eועוד. - ה-מפתח הוא ההזזה. פתרון הצפנה הוא פשוט להזיג אחורה.
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.
מדוע Caesar חלש
- יש רק 25 הזיות אפשריות, ולכן מחשב יכול לנסות אותן כולן בשנייה.
- זהו מתקפת כוח גס על המפתח — בדיוק מה שהצפנה אמיתית צריכה לעמוד בו.
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.
מה הצפרים האמיתיים עושים
- צפרים סימטריים מודרניים כמו AES משתמשים במפתחות עם מאות מיליארדים של אפשרויות.
- הבעיה הגדולה שנותרה: איך שני אנשים ישתפו את המפתח הסודי בבטחה? העבודה הבאה תפתור זאת.
כיסוי: IGCSE 2.3 (הצפנה סימטרית), A-Level 17.1.
Common mistakes
- One shared key both encrypts and decrypts.
- The hard part is sharing that key safely.
טעויות נפוצות
- מפתח משותק אחד גם מצפין וגם מפתח.
- החלק הקשה הוא לשותף את המפתח הזה בבטחה.
Symmetric encryption · הצפנה סימטרית
The Caesar cipher uses one shared key to encrypt and decrypt. · צפירת קזאר משתמשת במפתח משותף אחד להצפנה ולפענוח.
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. · הצפן את hello באמצעות צפירת קזאר: הזז כל אות קדימה בshift מקומות (חוזר מה-z לא-a). בנה את המחרוזת המוצפנת והדפס אותה.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.
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. · עכשיו פרץ אותה – זוהי הסיבה שקזאר הוא חלש. קבלת את cipher, ואתה חושד שהטקסט המקורי הוא attack. נסה כל הזזה מ-1 עד 25, מזיז אחורה, והדפס את ההזזה שהופכת את cipher לattack.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.