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.
تشفير قيصر
- أقدم مثال: إزاحة كل حرف للأمام بعدد ثابت. مع إزاحة مقدارها 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.
لماذا قيصر ضعيف
- هناك فقط 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. · اضغط تشغيل لرؤية المخرجات هنا.