Encryption and hashing
مُقدَّم
12:11
كيف تعمل التشفير
انظر إلى رمز القفل في شريط عنوان المتصفح. لقد كتبت اسم بنكك، وبشكل ما أصبح حاسوبك الآن متأكدًا تمامًا أنه يتحدث حقًا إلى البنك — و…
سرد باللغة الإنجليزية · ترجمة نصية بالإنجليزية و中文 يمكنك التبديل بينهما
في هذا الدرس
| English | المعنى |
|---|---|
| secret key | A value kept private and used to encrypt or decrypt data. |
| symmetric/sɪˈmetrɪk/ | متماثل |
| Encryption/enˈkrɪpʃn/ | The process of using a key to turn readable data into unreadable data. |
| codebooks | Books containing codes or keys used to protect secret messages. |
| shared secret/ʃeəd ˈsiːkrɪt/ | Confidential information known to authorised parties and used for a purpose such as authentication or encryption. |
| public channel | A way of sending information that other people can listen to. |
| RSA | An encryption method that uses a public key and a matching private key. |
| private key/ˈpraɪvət kiː/ | المفتاح الخاص |
| asymmetric/ˌeɪsɪˈmetrɪk/ | غير متماثل |
| one-way function | A process that is easy to perform but very hard to reverse. |
| hashing/ˈhæʃɪŋ/ | The process of calculating an initial record address from a key. |
| plaintext/ˈpleɪntekst/ | النص العادي |
| ciphertext/ˈsaɪfətekst/ | النص المشفر |
| decrypt/dɪˈkrɪpt/ | فك التشفير |
| confidentiality/ˌkɒnfɪˌdenʃiˈæləti/ | Keeping information private so only authorised people can read it. |
| algorithm/ˈælɡərɪθəm/ | A finite sequence of precise steps for solving a problem or carrying out a task. |
| AES/ˌeɪ iː ˈes/ | A fast encryption method that uses the same key to encrypt and decrypt data. |
| key distribution/kiː ˌdɪstrɪˈbjuːʃn/ | Securely providing or establishing the cryptographic keys that communicating parties need. |
| key pair/kiː peə/ | زوج المفاتيح |
| public key/ˈpʌblɪk kiː/ | المفتاح العام |
| key exchange | The process of sharing or agreeing a key for secure communication. |
| client/ˈklaɪənt/ | A device or program that requests a service or resource from a server. |
| session key/ˈseʃn kiː/ | مفتاح الجلسة |
| server/ˈsɜːvə/ | A computer or program that provides services or resources in response to requests from clients. |
| byte/baɪt/ | A group of eight bits, commonly used as a unit of data storage. |
| HTTPS/ˌeɪtʃ tiː tiː piː ˈes/ | A secure set of rules for transferring web pages and other web content. |
| SSH | A set of rules for securely connecting to and controlling a computer from another location. |
| Diffie–Hellman key agreement | A method for two parties to agree a shared secret over a public channel. |
| cryptographic hash/ˌkrɪptəˈɡræfɪk hæʃ/ | تخزين مشفر |
| digest/ˈdaɪdʒest/ | ملخص |
| salted password hashes | Stored values made by hashing passwords with added random data to make guessing harder. |
| database/ˈdeɪtəbeɪs/ | An organised collection of data that can be accessed and managed. |
| integrity/ɪnˈteɡrɪti/ | The accuracy, completeness and protection of data against unauthorised or unintended alteration. |
| message authentication code | A value made using a secret key to check who sent a message and whether it changed. |
| digital signature/ˈdɪdʒɪtl ˈsɪɡnɪtʃə/ | A cryptographic value created with a signing key and checked with a corresponding public key to verify data integrity and signing origin. |
الاثنان الغريبان يتفقان على سرّ في عام
- إليك مشكلة تبدو مستحيلة. لم تقابل متجرًا من قبل ولا تشاركه أي شيء. كل ما تقوله له يُستمع إليه من الجميع. اتفق على مفتاح سري.
- حتى عام 1976 كانت الإجابة هي أنه لا يمكن: التشفير المتماثل يحتاج إلى تسليم المفتاح مسبقًا، عبر مرسول أو شخصيًا، ولهذا السبب كانت كتب الشفرات الحربية تُطبع وتُشحن.
- ثم أظهروا ديفي وهيلمان، ولاحقًا ريفيست وشامير وآدلمان، أنه يمكن ذلك، باستخدام مفتاح يُمكّن فقط ومفتاح مختلف يُمكّن فقط. يعتمد كل عملية شراء قمت بها عبر الإنترنت عليه.
- هذه الدرس حول التشفير المتماثل وغير المتماثل، لماذا تستخدم الأنظمة الحقيقية كلاهما، والدالة أحادية الاتجاه المسماة التجزئة.
مفردات
- التشفير يحول النص الواضح المقروء إلى النص المشفر غير المقروء باستخدام مفتاح؛ أما فك التشفير فهو عكس العملية بالمفتاح المناسب.
- يحمي التشفير السرية: النسخ المحاصر لا يمكن فهمه. إنه لا يمنع استلام البيانات أو تأخيرها أو حذفها.
- القوة تكمن في المفتاح، وليس في إبقاء الخوارزمية سرية. يتم نشر الخوارزميات ودراستها تحديدًا لكي يتم العثور على نقاط الضعف من قبل الأصدقاء بدلاً من الأعداء.
التشفير المتماثل
- التشفير المتماثل يستخدم نفس المفتاح للتشفير وفك التشفير. معيار AES هو المثال القياسي.
- هو سريع، لذا فهو مناسب لـ البيانات الضخمة: قرص كامل، تدفق فيديو، ملف كبير.
- ضعفه هو توزيع المفاتيح: يجب أن يصل المفتاح للطرف الآخر دون أن يُحاصر، وإذا تم حصاره فإن النظام بأكمله ينهار. مع $n$ أشخاص يرغبون جميعهم في التحدث خصوصيًا بشكل ثنائي، فإن عدد المفاتيح المطلوبة ينمو مع مربع $n$.
A shift cipher (symmetric key)
Caesar's cipher shifts every letter forward by a fixed key. The SAME key both encrypts and decrypts — that is what symmetric means. Try to read the ciphertext without knowing the shift.
Symmetric encryption uses:
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Symmetric encryption shares one secret key — fast, but it must be distributed securely.
التشفير غير المتماثل
- التشفير غير المتماثل يمنح كل مستخدم زوج مفاتيح: مفتاح عام ينشره للعالم، ومفتاح خاص لا يكشف عنه أبدًا.
- أي شيء مشفر بالمفتاح العام يمكن فك تشفيره فقط بالمفتاح الخاص المطابق. لذلك لإرسال رسالة سرية لأليس، تقوم بتشفيره بمفتاحها العام، ولا يمكن لأليس فقط قراءته.
- لا حاجة لتبادل مفاتيح مسبق، مما يحل المشكلة التي افتتح بها الدرس. الثمن هو أنه أبطأ بكثير، لذا لا يُستخدم لكميات كبيرة من البيانات.

مفتاح واحد يُمكّن، والآخر يُمكّن، وأحدهما فقط هو السري

Match each cryptographic tool to what it uses.
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Symmetric is fast but needs key sharing; asymmetric solves that with a key pair; hashing is one-way; HTTPS combines them.
To send a confidential message to Alice using asymmetric encryption, you encrypt with:
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Encrypting with the recipient's public key means only their matching private key can decrypt it.
Match each kind of encryption to its main weakness.
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
The hybrid scheme uses each to cover the other's weakness: asymmetric to deliver the key, symmetric to carry the data.
مثال محلول: إرسال رسالة سرية
- اشرح كيف يسمح التشفير غير المتماثل لبوب بإرسال رسالة سرية لأليس، حتى لو لم يقبلها من قبل. [3]
- تنشر أليس مفتاحها العام، والذي قد يمتلكه أي شخص بما في ذلك المستمع الخفي.
- يقوم بوب بتشفير الرسالة بـ مفتاحها العام. لا يمكن فك تشفير النص المشفر إلا بواسطة المفتاح الخاص المطابق.
- تقوم أليس بفك تشفيره بمفتاحها الخاص، الذي لم تشاركه أبدًا. لا يستطيع المستمع الخفي الذي يحمل المفتاح العام والنص المشفر استعادة الرسالة.
- الخطأ الأكثر شيوعًا هو القول بأن بوب يشفر بـ مفتاحه الخاص. تتبع أي مفتاح يُستخدم في كل خطوة.
Bob wants Alice to be sure a message really came from him. Which key does Bob use to create the digital signature?
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Only Bob holds his private key, so only he can produce the signature; Alice checks it with Bob's public key. Confidentiality uses the receiver's keys, a signature uses the sender's.
النهج الهجين، وهو ما يحدث حقًا
- المتماثل سريع لكن لا يمكنه مشاركة مفتاحه؛ غير المتماثل يمكنه مشاركة مفتاح لكنه بطيء. تستخدم الأنظمة الحقيقية كل نوع لما هو جيد فيه.
- يولد العميل مفتاح جلسة عشوائي، ويشفر ذلك المفتاح الصغير بمفتاح الخادم العام، ويرسله. يفك الخادم تشفيره بمفتاحه الخاص، والآن كلا الجانبين يحملان نفس مفتاح الجلسة.
- يتم تشفير كل بايت من المحادثة الفعلية بشكل متماثل باستخدام مفتاح الجلسة هذا: سريع، وقد حدث الخطوة البطيئة غير المتماثلة مرة واحدة فقط، على عدد قليل من البايتات.
- هذا بالضبط كيف تعمل HTTPS و SSH.

غير متماثل للاتفاق على المفتاح، ومتماثل لنقل البيانات

In the hybrid approach used by HTTPS, asymmetric encryption is used to:
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Slow asymmetric crypto just shares a session key; the bulk data then uses fast symmetric encryption.
Put the steps of this example hybrid encryption scheme in order.
الصعوبة 3/5 · 200 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
The slow asymmetric step runs once, on a few bytes; everything after it is fast symmetric encryption.
التجزئة
- التجزئة المشفرة تحول مدخلًا بأي حجم إلى ملخص ثابت الحجم. نفس المدخل يعطي دائمًا نفس الملخص، والتغيير الطفيف في المدخل يغير الملخص تمامًا.
- هو أحادي الاتجاه: لا يمكن استعادة المدخل من الملخص. هذا هو الغرض الكامل منه، وهو ما يجعله مختلفًا عن التشفير، المصمم ليكون قابلًا للعكس.
- الاستخدامات: تخزين كلمات المرور، حيث يحتفظ النظام بالملخص فقط ويقارن الملخصات عند تسجيل الدخول، sehingga قاعدة بيانات مسروقة لا توفر كلمات مرور؛ والتحقق من سلامة البيانات، حيث يتم إعادة حساب ملخص الملف ومقارنته للكشف عن أي تغيير.

A cryptographic hash produces a fixed-size ____ from an input of any size.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
The same input always gives the same digest, a small change gives a completely different one, and the input cannot be recovered from it.
تم تصحيح هذه البطاقة، لذلك تظهر باللغة الإنجليزية حتى يتم تحديث ترجمتها.
Worked example: why hash a password instead of encrypting it
- A website stores users' passwords as hashes rather than as encrypted text. Explain why.
- Encryption 加密 is reversible: a key exists somewhere that turns the stored value back into the password, and an attacker who obtains the database may also obtain the key.
- Hashing is one-way, so the stored digest cannot simply be reversed to reveal the password. However, attackers can still guess passwords and compare hashes; salted, slow password hashes make this harder.
- Login still works because the system hashes what the user typed and compares digests, never the passwords themselves.
Hashing and the avalanche effect
A hash is one-way: easy to compute, practically impossible to reverse. A tiny change in the input flips a large, unpredictable part of the output — the avalanche effect that makes hashes good for passwords.
A cryptographic hash is one-way (you cannot recover the input from the digest) and shows the avalanche effect — a tiny change in the input flips a large, unpredictable part of the output.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
One-wayness plus avalanche is what makes hashes good for storing passwords and checking integrity.
Why store passwords as hashes rather than encrypted? Select جميعها that apply.
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
A fixed-size digest may indeed be shorter, but that is not the security reason. Irreversibility is.
علامات ضائعة
- لإرسال رسالة سرية لشخص ما، استخدم مفتاحه العام، وليس مفتاحك. قل اسم المفتاح في كل خطوة.
- ضعف التشفير المتماثل هو توزيع المفاتيح؛ وضعف التشفير غير المتماثل هو السرعة. يستخدم النظام الهجين كل منهما لتعويض الآخر.
- التشفير العكسي (Hashing) هو ذو اتجاه واحد ولا يُعد تشفيراً: لا توجد مفتاح ولا يوجد ما يمكن فك تشفيره.
- يحمي التشفير السرية فقط. ولا يمنع الاستماع، أو الحذف، أو تعديل الرسالة دون اكتشاف ذلك: لذلك تحتاج إلى دالة تجميع.
لقد فهمت الأمر
- التشفير يحول النص الواضح إلى نص مشفر باستخدام مفتاح ويحمي السرية فقط؛ قوة النظام تكمن في المفتاح، وليس في إخفاء الخوارزمية
- متماثل: مفتاح مشترك واحد، سريع، مناسب للبيانات الضخمة، ضعيف في توزيع المفاتيح · غير متماثل: مفتاح عام للتشفير ومفتاح خاص لفك التشفير، لا يتطلب تبادلًا مسبقًا، لكنه بطيء
- النظام الهجين المستخدم في HTTPS وSSH يرسل مفتاح جلسة عشوائي مشفرة بشكل غير متماثل، ثم ينقل البيانات بشكل متماثل
- التشفير العكسي ينتج ملخصاً بحجم ثابت، وهو ذو اتجاه واحد، ويُستخدم لكلمات المرور وفحص سلامة البيانات
ما المشكلة؟ لا يرى ذلك سوى فريق الموقع.