Chapterبەش 5 · Lectureوانە 5.2

Encryption, Hashing and Digital Signaturesشفرەکردن، هاشکردن و واژووە دیجیتاڵییەکان

An added lesson on the basics of cryptography: plaintext, ciphertext and keys; the Caesar cipher with a small Python demo and why brute force breaks it; symmetric encryption (AES) and asymmetric encryption (public and private keys) and how real systems combine them; hash functions, salts and safe password storage; digital signatures, certificates and TLS; and encryption in transit, at rest and end to end.

وانەیەکی زیادکراو دەربارەی بنەماکانی : ، و کلیل؛ لەگەڵ نموونەیەکی بچووکی Python و ئەوەی بۆچی دەیشکێنێت؛ ⁦(AES)⁩ و ( و ) و چۆن سیستەمە ڕاستەقینەکان تێکەڵیان دەکەن؛ ، و هەڵگرتنی سەلامەتی ؛ ، و TLS؛ هەروەها لە گواستنەوەدا، لە دۆخی وەستاودا و بە شێوەی سەرتاسەری.

27 min read28 خولەک خوێندنەوە · 25 stepsهەنگاو

What you will learnچی فێر دەبیت

  • Use the words plaintext, ciphertext, cipher, key, encryption and decryption correctly.
  • Encrypt and decrypt with the Caesar cipher, and explain why a brute-force attack breaks it but not AES.
  • Compare symmetric and asymmetric encryption and say which key is used for what.
  • Explain hashing and salting, and why passwords are hashed rather than encrypted.
  • Describe what digital signatures, certificates and TLS provide, and where data is encrypted in transit, at rest and end to end.
  • وشەکانی ، ، ، کلیل، و بە دروستی بەکار بهێنیت.
  • بە شفرە بکەیت و بیکەیتەوە و ڕوونی بکەیتەوە بۆچی ئەو دەشکێنێت بەڵام AES ناشکێنێت.
  • و بەراورد بکەیت و بڵێیت کام کلیل بۆ چی بەکار دێت.
  • هاشکردن و ڕوون بکەیتەوە و بڵێیت بۆچی هاش دەکرێن نەک شفرە.
  • وەسفی ئەوە بکەیت کە ، و TLS چی دەدەن و لە کوێدا لە گواستنەوەدا، لە دۆخی وەستاودا و سەرتاسەری شفرە دەکرێت.

Why we need cryptographyبۆچی کریپتۆگرافیمان پێویستە

When you send a message from your phone, it does not fly straight to your friend. It passes the café's Wi-Fi, your internet provider, several routers and a server. Any of these places could be watched. Cryptography is the science of protecting information on that open road, using mathematics.

کاتێک لە مۆبایلەکەتەوە نامەیەک دەنێریت، ڕاستەوخۆ ناگاتە لای هاوڕێکەت. بە چایخانەکە، دابینکەری ، چەند ڕاوتەرێک و تێدەپەڕێت. هەر یەکێک لەم شوێنانە دەکرێت چاودێری بکرێت. زانستی پاراستنی لەو ڕێگا کراوەیەدا بە یارمەتیی بیرکاری.

A postcard and a sealed envelopeکارتپۆستاڵێک و زەرفێکی داخراو

A message sent without cryptography is like a postcard at the post office: every clerk who handles it can read it, and someone could even change the words. Encryption puts the card in a sealed envelope that only the receiver can open. A signature is like the sender's own seal pressed into the wax: if the seal is broken or wrong, you know.

نامەیەک کە بەبێ دەنێردرێت وەک کارتپۆستاڵێکە لە پۆستخانەدا: هەر فەرمانبەرێک کە بە دەستیدا دێت دەتوانێت بیخوێنێتەوە، تەنانەت کەسێک دەتوانێت وشەکانیش بگۆڕێت. کارتەکە دەخاتە ناو زەرفێکی داخراوەوە کە تەنها وەرگرەکە دەتوانێت بیکاتەوە. واژووش وەک مۆری تایبەتی نێرەرەکە وایە کە لەسەر مۆمەکە دادەنرێت: ئەگەر مۆرەکە شکابێت یان هەڵە بێت، پێی دەزانیت.

Where the analogy stops workingسنووری ئەم نموونەیە

A real envelope can be steamed open by a patient thief. Good encryption cannot be opened without the key, even with all the computers in the world working for years.

زەرفێکی ڕاستەقینە دزێکی بە ئارام دەتوانێت بە هەڵم بیکاتەوە. باش بەبێ کلیلەکە ناکرێتەوە، تەنانەت ئەگەر هەموو جیهان چەندین ساڵ کاری بۆ بکەن.

Quick checkپشکنینی خێراIn the postcard picture, what does encryption do?لە وێنەی کارتپۆستاڵەکەدا، چی دەکات؟

Why we need cryptographyبۆچی کریپتۆگرافیمان پێویستە

Three jobs: secret, unchanged, provenسێ کار: نهێنی، نەگۆڕاو، سەلمێنراو

Cryptography does three different jobs. Keep each one in mind, because each tool in this lesson does only some of them:

سێ کاری جیاواز دەکات. هەر سێکیان لە بیر بێت، چونکە هەر ئامرازێکی ئەم وانەیە تەنها هەندێکیان دەکات:

  • Keep it secret (confidentiality): only the right person can read the message. Tool: encryption.
  • Notice any change (integrity): if one letter is changed on the way, you find out. Tool: hashing.
  • Prove who sent it (authenticity and non-repudiation): the sender cannot be faked and cannot deny it later. Tool: digital signatures.
  • نهێنی بیهێڵەرەوە (): تەنها کەسی ڕاست دەتوانێت نامەکە بخوێنێتەوە. ئامراز: .
  • هەر گۆڕانێک هەست پێ بکە (): ئەگەر یەک پیت لە ڕێگادا بگۆڕدرێت، پێی دەزانیت. ئامراز: .
  • بیسەلمێنە کێ ناردوویەتی ( و ): نێرەر ناکرێت ساختە بکرێت و دواتر ناتوانێت نکۆڵی لێ بکات. ئامراز: .

These are the goals you met in the CIA triad and its extra goals. This lesson shows the tools that reach them.

ئەمانە هەمان ئەو ئامانجانەن کە لە سێگۆشەی CIA و ئامانجە زیادەکانیدا بینیت. ئەم وانەیە ئەو ئامرازانە پیشان دەدات کە دەیانگەیەننە ئەو ئامانجانە.

Quick checkپشکنینی خێراYou want to be sure that nobody changed a file while it was downloading. Which goal is that?دەتەوێت دڵنیا بیت کەس فایلێکی نەگۆڕیوە لە کاتی . ئەمە کام ئامانجە؟

Plaintext, ciphertext and the keyدەقی ئاشکرا، دەقی شفرەکراو و کلیل

Five words appear in every explanation of encryption. Learn them once:

پێنج وشە لە هەموو ڕوونکردنەوەیەکی دەردەکەون. یەک جار فێریان ببە:

WordوشەMeaningواتاExampleنموونە
PlaintextThe readable message.نامە خوێندراوەکە.HELLO
CiphertextThe scrambled result. It looks like nonsense.ئەنجامە تێکەڵکراوەکە. وەک قسەی بێمانا دەردەکەوێت.KHOOR
Cipher (algorithm) ()The method: the rule for scrambling and unscrambling.ڕێگاکە: ڕێسای تێکەڵکردن و کردنەوە."Move every letter forward"«هەموو پیتێک بەرەو پێش ببە»
KeyThe secret setting the method uses. Same method, different key: different ciphertext.ئەو ڕێکخستنە نهێنییەی ڕێگاکە بەکاری دەهێنێت. هەمان ڕێگا و کلیلی جیاواز: جیاواز.3 places3 هەنگاو
Encryption / decryption / Plaintext → ciphertext / ciphertext → plaintext. ← / ← .HELLO ⇄ KHOOR

NIST, the US standards institute, defines encryption simply: changing plaintext into ciphertext using an algorithm and a key. The algorithm can be public; the key must stay secret.

NIST، دامەزراوەی ستانداردەکانی ئەمریکا، بە سادەیی پێناسە دەکات: گۆڕینی بۆ بە بەکارهێنانی و کلیلێک. دەکرێت ئاشکرا بێت؛ کلیلەکە دەبێت نهێنی بمێنێتەوە.

An animation in five steps. Aram types the plaintext HELLO. It enters a box labelled 'Encrypt' together with the key 3, and comes out as the ciphertext KHOOR. KHOOR travels across the internet; an eavesdropper in the middle copies it but sees only KHOOR. At Shilan's side it enters a box labelled 'Decrypt' with the same key 3 and comes out as HELLO again. In the last frame someone tries the wrong key 4 and gets the nonsense GDKKN.
An animation in five steps. Aram types the plaintext HELLO. It enters a box labelled 'Encrypt' together with the key 3, and comes out as the ciphertext KHOOR. KHOOR travels across the internet; an eavesdropper in the middle copies it but sees only KHOOR. At Shilan's side it enters a box labelled 'Decrypt' with the same key 3 and comes out as HELLO again. In the last frame someone tries the wrong key 4 and gets the nonsense GDKKN.
Encryption with a key, the journey, decryption with the same key — and what the wrong key gives. بە کلیل، گەشتەکە، بە هەمان کلیل — و ئەوەی کلیلی هەڵە دەیدات.CêIT
Quick checkپشکنینی خێراAn eavesdropper copies the ciphertext but does not have the key. What does she learn?گوێگرێکی دزەکی کۆپی دەکات بەڵام کلیلەکەی نییە. چی دەزانێت؟

The oldest example: the Caesar cipherکۆنترین نموونە: شفرەی قەیسەر

The idea is said to go back to Roman times and is named after Julius Caesar. Pick a key k, a number from 1 to 25. To encrypt, move every letter k places forward in the alphabet. To decrypt, move it k places back.

دەگوترێت ئەم بیرۆکەیە بۆ سەردەمی ڕۆمانییەکان دەگەڕێتەوە و ناوی جولیوس قەیسەری لێ نراوە. کلیلێکی k هەڵبژێرە، ژمارەیەک لە 1 تا ⁦25⁩. بۆ ، هەموو پیتێک k شوێن لە ئەلفوبێدا بەرەو پێش ببە. بۆ ، k شوێن بیگەڕێنەرەوە دواوە.

The Caesar cipher with key 3: each letter moves three places; after Z it wraps round to A. بە کلیلی 3: هەر پیتێک سێ شوێن دەجووڵێت؛ دوای Z دەگەڕێتەوە بۆ A.
PlainABCDEFGHIJKLM
Cipher (key 3) (کلیلی ⁦3⁩)DEFGHIJKLMNOP
PlainNOPQRSTUVWXYZ
Cipher (key 3) (کلیلی ⁦3⁩)QRSTUVWXYZABC

Mathematicians number the letters A=0,B=1,…,Z=25A = 0, B = 1, \ldots, Z = 25. Then encryption and decryption are two short formulas. mod 26 means 'take the remainder after dividing by 26', which is what makes Z wrap round to A:

بیرکاریزانەکان پیتەکان ژمارە دەکەن: A=0,B=1,…,Z=25A = 0, B = 1, \ldots, Z = 25. ئەوکات و دوو هاوکێشەی کورتن. ⁦mod 26⁩ واتە « دوای دابەشکردن بەسەر ⁦26⁩دا وەربگرە»، ئەمەیە کە وا دەکات Z بگەڕێتەوە بۆ A:

Ek(m)=(m+k) mod 26Dk(c)=(c−k) mod 26\begin{aligned} E_k(m) &= (m + k) \bmod 26 \\ D_k(c) &= (c - k) \bmod 26 \end{aligned}

mm is the number of a plaintext letter, cc the number of a ciphertext letter, kk the key. For example, with k=3k = 3: X is 23, and (23+3) mod 26=0(23 + 3) \bmod 26 = 0, which is A.

mm ژمارەی پیتێکی ، cc ژمارەی پیتێکی و kk کلیلەکەیە. بۆ نموونە، بە k=3k = 3: ژمارەی X دەکاتە ⁦23⁩ و (23+3) mod 26=0(23 + 3) \bmod 26 = 0 کە دەکاتە A.

Worked example: encrypt CYBER with key 3نموونەی کارپێکراو: CYBER بە کلیلی 3 شفرە بکە
  1. Write the letters as numbersپیتەکان وەک ژمارە بنووسە

    C Y B E R→2,24,1,4,17\text{C Y B E R} \to 2, 24, 1, 4, 17

    C Y B E R→2,24,1,4,17\text{C Y B E R} \to 2, 24, 1, 4, 17

  2. Add the key 3کلیلی 3 زیاد بکە

    5,27,4,7,205, 27, 4, 7, 20

    5,27,4,7,205, 27, 4, 7, 20

  3. Take mod 26⁦mod 26⁩ وەربگرە

    27 mod 26=127 \bmod 26 = 1; the others stay: 5,1,4,7,205, 1, 4, 7, 20.

    27 mod 26=127 \bmod 26 = 1؛ ئەوانی تر وەک خۆیان دەمێننەوە: 5,1,4,7,205, 1, 4, 7, 20.

  4. Turn the numbers back into lettersژمارەکان بکەرەوە بە پیت

    FBEHU. So CYBER encrypts to FBEHU.

    FBEHU. کەواتە CYBER دەبێتە FBEHU.

Quick checkپشکنینی خێراWith the Caesar cipher and key 3, what is the ciphertext of ZOO?بە و کلیلی 3، ZOO چییە؟

کۆرسی سایبەر سیکورتی و ئەلگۆریثمەکانی Cyber Security Algorithm #4 Caesar Cipherچوارگۆشە : Chwargosha · Kurdish (Sorani)کوردی (سۆرانی) · 2.2K viewsبینین · 55 likesلایک

In Kurdish: the Caesar cipher, C = (P + k) mod 26 and P = (C - k) mod 26, with worked examples.

بە کوردی: ، C=(P+k) mod 26C = (P + k) \bmod 26 و P=(C−k) mod 26P = (C - k) \bmod 26، لەگەڵ نموونەی هەنگاو بە هەنگاو.

Whole video (10:35), Sorani: encrypting and decrypting with the Caesar cipher.

هەموو ڤیدیۆکە ⁦(10:35)⁩، بە سۆرانی: و بە .

The oldest example: the Caesar cipherکۆنترین نموونە: شفرەی قەیسەر

The Caesar cipher in a few lines of Pythonشفرەی قەیسەر لە چەند دێڕێکی Pythonـدا

You do not need to program to follow this course, but seeing a cipher as code makes the idea concrete. This short Python program encrypts a message, decrypts it with the right key, and shows what the wrong key gives.

بۆ بەدواداچوونی ئەم کۆرسە پێویست ناکات بزانیت، بەڵام بینینی وەک کۆد بیرۆکەکە ڕوونتر دەکاتەوە. ئەم بەرنامە کورتەی Python نامەیەک شفرە دەکات، بە کلیلە ڕاستەکە دەیکاتەوە و پیشانی دەدات کلیلی هەڵە چی دەدات.

Encrypt and decrypt with the Caesar cipherشفرەکردن و کردنەوە بە شفرەی قەیسەرcaesar.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def shift_text(text, key):
    result = ""
    for ch in text.upper():
        if ch in ALPHABET:
            m = ALPHABET.index(ch)       # A=0, B=1, ... Z=25
            c = (m + key) % 26           # move key places, wrap around after Z
            result += ALPHABET[c]
        else:
            result += ch                 # spaces and punctuation stay
    return result

def encrypt(plaintext, key):
    return shift_text(plaintext, key)

def decrypt(ciphertext, key):
    return shift_text(ciphertext, -key)

secret = encrypt("MEET AT THE TEA HOUSE", 3)
print("Ciphertext:", secret)
print("Decrypted: ", decrypt(secret, 3))
print("Wrong key: ", decrypt(secret, 4))
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 7-8

Turn the letter into a number (A = 0), add the key and wrap round with % 26: exactly the formula above.

پیتەکە دەکاتە ژمارە ⁦(A = 0)⁩، کلیلەکەی بۆ زیاد دەکات و بە % 26 دەیگەڕێنێتەوە سەرەتا: ڕێک هاوکێشەکەی سەرەوە.

Lineدێڕی 17-18

Decryption is the same shift with the key turned negative.

هەمان جووڵەیە بەڵام کلیلەکە سالب دەکرێت.

Lineدێڕی 23

The wrong key gives nonsense, but notice that it is still letters and spaces: the word lengths leak.

کلیلی هەڵە قسەی بێمانا دەدات، بەڵام سەرنج بدە هێشتا پیت و بۆشاییە: درێژیی وشەکان ئاشکرا دەبن.

Quick checkپشکنینی خێراIn the program, why does decrypt call shift_text(ciphertext, -key)?لە بەرنامەکەدا، بۆچی decrypt بە شێوەی shift_text(ciphertext, -key) بانگ دەکرێت؟

The oldest example: the Caesar cipherکۆنترین نموونە: شفرەی قەیسەر

Why the Caesar cipher is easy to breakبۆچی شفرەی قەیسەر بە ئاسانی دەشکێنرێت

The Caesar cipher has only 25 useful keys. An attacker who intercepts a message does not need the key: she simply tries all 25. This is a brute-force attack. A computer does it in less than a millisecond:

تەنها ⁦25⁩ کلیلی بەسوودی هەیە. کە نامەیەک دەگرێت پێویستی بە کلیلەکە نییە: بە سادەیی هەر ⁦25⁩یان تاقی دەکاتەوە. ئەمە ـە. لە کەمتر لە میلیچرکەیەکدا دەیکات:

Try every keyهەموو کلیلەکان تاقی بکەرەوەcaesar_brute.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def decrypt(text, key):
    out = ""
    for ch in text:
        if ch in ALPHABET:
            out += ALPHABET[(ALPHABET.index(ch) - key) % 26]
        else:
            out += ch
    return out

intercepted = "PHHW DW WKH WHD KRXVH"
for key in range(1, 26):              # only 25 keys to try
    print(f"key {key:2}: {decrypt(intercepted, key)}")
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 13-14

A loop over the 25 possible keys. Only one line of the output makes sense.

خولێک بەسەر ⁦25⁩ کلیلە گونجاوەکەدا. تەنها یەک دێڕی ئەنجامەکە مانای هەیە.

Modern ciphers survive this attack because their key space is enormous. AES, the standard used today, has keys of 128, 192 or 256 bits. Even the smallest gives

نوێ لەم دەردەچن، چونکە ژمارەی کلیلە گونجاوەکانیان زۆر زۆر گەورەیە. AES، ستانداردی ئەمڕۆ، کلیلی ⁦128⁩، ⁦192⁩ یان ⁦256⁩ هەیە. تەنانەت بچووکترینیان دەدات

2128≈3.4×10382^{128} \approx 3.4 \times 10^{38}

That is how many keys there are. A computer trying a million million (101210^{12}) keys every second would need about 1.1×10191.1 \times 10^{19} years to try them all: hundreds of millions of times the age of the universe.

ئەمە ژمارەی کلیلەکانە. کە لە هەر چرکەیەکدا ملیۆن ملیۆن (101210^{12}) کلیل تاقی بکاتەوە، نزیکەی 1.1×10191.1 \times 10^{19} ساڵی پێویستە بۆ تاقیکردنەوەی هەموویان: سەدان ملیۆن جار تەمەنی گەردوون.

Quick checkپشکنینی خێراWhy can a modern cipher such as AES not be broken by trying every key?بۆچی نوێی وەک AES بە تاقیکردنەوەی هەموو کلیلەکان ناشکێنرێت؟

The oldest example: the Caesar cipherکۆنترین نموونە: شفرەی قەیسەر

Patterns leak, and the method is not the secretشێوازەکان دزە دەکەن و ڕێگاکە نهێنییەکە نییە

Quick checkپشکنینی خێراIn a long Caesar-encrypted text, the letter H appears far more often than any other. What can an attacker guess?لە دەقێکی درێژدا کە بە شفرە کراوە، پیتی H لە هەموو پیتەکانی تر زیاتر دەردەکەوێت. چی دەتوانێت مەزەندە بکات؟

Symmetric encryption: one shared keyشفرەکردنی هاوچەشن: یەک کلیلی هاوبەش

Definitionپێناسە

in which the same secret key locks and unlocks the data, so both sides must share it safely beforehand. It is fast; AES is the best-known example.

جۆرێکە لە کە تێیدا هەمان کلیلی نهێنی دراوەکە قفڵ دەکات و دەیکاتەوە، بۆیە هەردوولا دەبێت پێشتر بە شێوەیەکی پارێزراو بەشی بکەن. خێرایە؛ AES ناسراوترین نموونەیە.

The Caesar cipher is symmetric: the same key locks and unlocks. Modern symmetric ciphers work on blocks of bits instead of letters, but the idea is the same. The most used one is AES (Advanced Encryption Standard), published by NIST in 2001. It encrypts blocks of 128 bits with a key of 128, 192 or 256 bits.

هاوچەشنە: هەمان کلیل دادەخات و دەکاتەوە. هاوچەشنی نوێ لەسەر کۆمەڵە کار دەکەن نەک لەسەر پیت، بەڵام بیرۆکەکە هەمانە. بەکارهاتووترینیان AESـە (ستانداردی پێشکەوتووی ) کە NIST لە ساڵی ⁦2001⁩دا بڵاوی کردەوە. کۆمەڵەی ⁦128⁩ بە کلیلێکی ⁦128⁩، ⁦192⁩ یان ⁦256⁩ شفرە دەکات.

Diagram: Aram and Shilan each hold a copy of the same key. Aram's plaintext goes through 'Encrypt' with the key and becomes ciphertext; the ciphertext crosses the internet; Shilan's 'Decrypt' with the identical key turns it back into plaintext. A warning under the picture asks: how did they share the key safely?وێنە: ئارام و شیلان هەریەکەیان کۆپییەکی هەمان کلیلیان پێیە. دەقی ئاشکرای ئارام بە کلیلەکە بە «شفرەکردن»دا تێدەپەڕێت و دەبێتە دەقی شفرەکراو؛ دەقە شفرەکراوەکە بە ئینتەرنێتدا دەڕوات؛ «شفرەکردنەوە»ـی شیلان بە هەمان کلیل دەیگەڕێنێتەوە بۆ دەقی ئاشکرا. ئاگادارییەک لە ژێر وێنەکەدا دەپرسێت: چۆن کلیلەکەیان بە سەلامەتی هاوبەش کرد؟
Symmetric encryption: the same key on both sides.: هەمان کلیل لە هەردوو لا.CêIT
Quick checkپشکنینی خێراWhich statement about AES is correct?کام ڕستە دەربارەی AES دروستە؟

Symmetric encryption: one shared keyشفرەکردنی هاوچەشن: یەک کلیلی هاوبەش

Fast, but how do we share the key?خێرایە، بەڵام چۆن کلیلەکە هاوبەش بکەین؟

  • Strength: it is very fast. Your phone can encrypt a whole film's worth of data in seconds, so it is used for disks, Wi-Fi and the bulk of every secure web page.
  • Weakness — sharing the key: both people need the same secret key before they can talk. If you send the key over the same open network, an eavesdropper copies it too. And with many people you need many keys: every pair needs its own.
  • خاڵی بەهێز: زۆر خێرایە. مۆبایلەکەت دەتوانێت فیلمێکی تەواو لە چەند چرکەیەکدا شفرە بکات، بۆیە بۆ دیسک، و زۆربەی هەموو پەڕەیەکی وێبی پارێزراو بەکار دێت.
  • خاڵی لاواز — هاوبەشکردنی کلیل: هەردوو کەس پێش قسەکردن پێویستیان بە هەمان کلیلی نهێنی هەیە. ئەگەر کلیلەکە بە هەمان کراوەدا بنێریت، گوێگرە دزەکییەکەش کۆپیی دەکات. هەروەها لەگەڵ زۆر کەسدا زۆر کلیلت پێویستە: هەر جووتێک کلیلێکی جیای بۆ خۆی دەوێت.
The shop key and its copyکلیلی دوکان و کۆپییەکەی

A shopkeeper in the bazaar gives his partner a copy of the shop key. Whoever has a copy can open the shop. The lock is excellent, but the danger is the moment the copy is handed over, and every extra copy is one more that can be lost.

دوکاندارێک لە بازاڕدا کۆپییەکی کلیلی دوکانەکە دەدات بە هاوبەشەکەی. هەر کەسێک کۆپییەکی پێ بێت دەتوانێت دوکانەکە بکاتەوە. قفڵەکە زۆر باشە، بەڵام مەترسییەکە ئەو ساتەیە کە کۆپییەکە دەدرێت و هەر کۆپییەکی زیادە یەکێکی ترە کە دەکرێت ون بێت.

Where the analogy stops workingسنووری ئەم نموونەیە

A shop key can be handed over in person. Two computers on opposite sides of the world usually cannot meet; the next screen shows how they solve this.

کلیلی دوکان دەکرێت ڕوو بە ڕوو بدرێت. دوو لە دوو سەری جیهان زۆربەی کات ناتوانن یەکتر ببینن؛ پەڕەی داهاتوو پیشان دەدات چۆن ئەم کێشەیە چارەسەر دەکەن.

Quick checkپشکنینی خێراWhat is the main problem of symmetric encryption?کێشەی سەرەکیی چییە؟

Asymmetric encryption: a public key and a private keyشفرەکردنی ناهاوچەشن: کلیلی گشتی و کلیلی تایبەت

Definitionپێناسە

that uses a pair of keys: a that anyone may use to encrypt, and a that only the owner keeps, to decrypt. It solves the problem of sharing a secret key with strangers.

جۆرێکە لە کە جووتێک کلیل بەکار دەهێنێت: کە هەرکەسێک دەتوانێت بۆ شفرەکردن بەکاری بهێنێت و کە تەنیا خاوەنەکەی بۆ شفرەکردنەوە لای خۆی دەیهێڵێتەوە. کێشەی بەشکردنی کلیلی نهێنی لەگەڵ کەسانی نەناسراودا چارەسەر دەکات.

In the 1970s mathematicians found a way around the key-sharing problem. Each person creates two keys that belong together. The public key can be given to everyone. The private key never leaves its owner. What one key locks, only the other key can unlock. RSA and elliptic-curve cryptography are the best-known methods.

لە ساڵانی ⁦1970⁩دا بیرکاریزانەکان ڕێگایەکیان دۆزییەوە بۆ دەربازبوون لە کێشەی هاوبەشکردنی کلیل. هەر کەسێک دوو کلیل دروست دەکات کە پێکەوە دەگونجێن. دەکرێت بدرێت بە هەمووان. هەرگیز لای خاوەنەکەی دەرناچێت. ئەوەی کلیلێک دایدەخات، تەنها کلیلەکەی تر دەتوانێت بیکاتەوە. RSA و چەماوەی ئێلیپتیکی ناسراوترین ڕێگاکانن.

Diagram: Shilan has a key pair. Her public key is copied freely to Aram and to anyone else. Aram encrypts his message with Shilan's public key. The ciphertext can be opened only with Shilan's private key, which stays on her phone. An eavesdropper who has the public key still cannot read it.وێنە: شیلان جووتێک کلیلی هەیە. کلیلی گشتیی ئەو بە ئازادی کۆپی دەکرێت بۆ ئارام و هەر کەسێکی تر. ئارام نامەکەی بە کلیلی گشتیی شیلان شفرە دەکات. دەقە شفرەکراوەکە تەنها بە کلیلی تایبەتی شیلان دەکرێتەوە کە لەسەر مۆبایلەکەی دەمێنێتەوە. گوێگرێکی دزەکی کە کلیلە گشتییەکە هەیە هێشتا ناتوانێت بیخوێنێتەوە.
Asymmetric encryption: lock with the receiver's public key, unlock with her private key.: بە وەرگر دابخە، بە ئەو بیکەرەوە.CêIT
The post-office box with a slotسندووقی پۆست بە کونێکەوە

Think of a locked mailbox with a slot. Anyone who knows where it is can drop a letter through the slot (the public key). Only the owner has the key that opens the box (the private key). You can tell the whole city where your box is, and your letters are still safe.

بیر لە سندووقێکی پۆستی قفڵدراو بکەرەوە کە کونێکی هەیە. هەر کەسێک بزانێت لە کوێیە دەتوانێت نامەیەک لە کونەکەوە بخاتە ناوی (). تەنها خاوەنەکەی ئەو کلیلەی هەیە کە سندووقەکە دەکاتەوە (). دەتوانیت بە هەموو شار بڵێیت سندووقەکەت لە کوێیە و نامەکانت هێشتا سەلامەتن.

Where the analogy stops workingسنووری ئەم نموونەیە

In a real mailbox the slot and the lock are separate pieces of metal. In cryptography the two keys are linked by mathematics, and it must be practically impossible to work out the private key from the public one.

لە سندووقی ڕاستەقینەدا کونەکە و قفڵەکە دوو پارچە ئاسنی جیاوازن. لە هەردوو کلیلەکە بە بیرکاری بەیەکەوە بەستراون و دەبێت بە کردەیی مەحاڵ بێت لە بدۆزرێتەوە.

FeatureتایبەتمەندیSymmetricAsymmetric
KeysکلیلەکانOne secret key, sharedیەک کلیلی نهێنیی هاوبەشA pair: public + privateجووتێک: +
SpeedخێراییVery fastزۆر خێراMuch slowerزۆر خاوتر
Key sharingهاوبەشکردنی کلیلThe hard partبەشە قورسەکەEasy: publish the public keyئاسان: بڵاو بکەرەوە
ExamplesنموونەAESRSA, elliptic curvesRSA، چەماوەی ئێلیپتیکی
Quick checkپشکنینی خێراAram wants to send Shilan a secret. Which key does he use to encrypt it?ئارام دەیەوێت نهێنییەک بۆ شیلان بنێرێت. بە کام کلیل شفرەی دەکات؟

Asymmetric encryption: a public key and a private keyشفرەکردنی ناهاوچەشن: کلیلی گشتی و کلیلی تایبەت

In practice: both togetherلە بەکارهێنانی ڕاستەقینەدا: هەردووکیان پێکەوە

Asymmetric encryption solves key sharing but is slow. Symmetric encryption is fast but needs a shared key. So real systems use both: asymmetric cryptography first, only to agree on a fresh symmetric key (a session key); then fast AES with that key for all the data. One famous way to agree on a key in public is the Diffie–Hellman key exchange (1976): both sides send each other public values, and each one can compute the same secret from them, while an eavesdropper who saw everything cannot.

کێشەی هاوبەشکردنی کلیل چارەسەر دەکات بەڵام خاوە. خێرایە بەڵام کلیلێکی هاوبەشی پێویستە. بۆیە سیستەمە ڕاستەقینەکان هەردووکیان بەکار دەهێنن: سەرەتا ناهاوچەشن، تەنها بۆ ڕێککەوتن لەسەر هاوچەشنی نوێ (کلیلی دانیشتن)؛ پاشان AESـی خێرا بەو کلیلە بۆ هەموو . یەکێک لە ڕێگا بەناوبانگەکانی ڕێککەوتن لەسەر کلیل بە ئاشکرا ئاڵوگۆڕی کلیلی ⁦Diffie–Hellman⁩ـە ⁦(1976)⁩: هەردوو لا نرخی گشتی بۆ یەکتر دەنێرن و هەریەکەیان دەتوانێت لەوانەوە هەمان نهێنی حیساب بکات، لە کاتێکدا گوێگرێکی دزەکی کە هەمووی بینیوە ناتوانێت.

This is exactly what your browser does when it opens a secure web page; the screen on TLS below shows it.

ئەمە ڕێک ئەو کارەیە کە دەیکات کاتێک پەڕەیەکی وێبی پارێزراو دەکاتەوە؛ پەڕەی TLS لە خوارەوە پیشانی دەدات.

Quick checkپشکنینی خێراWhy does a secure web connection not use asymmetric encryption for all the data?بۆچی پەیوەندیی وێبی پارێزراو بۆ هەموو بەکار ناهێنێت؟

Asymmetric encryption: a public key and a private keyشفرەکردنی ناهاوچەشن: کلیلی گشتی و کلیلی تایبەت

Looking ahead: quantum computersسەیرکردنی داهاتوو: کۆمپیوتەرە کوانتەمییەکان

Quick checkپشکنینی خێراWhich kind of cryptography is most at risk from a large quantum computer?کام جۆری زیاتر لە هەموو لە مەترسیی کوانتەمیی گەورەدایە؟

Hashing: a fingerprint of the dataهاشکردن: پەنجەمۆری دراوە

Definitionپێناسە

A function that turns any input into a short value of fixed size, called a hash; the same input always gives the same hash. A uses a fast hash function to choose where each is stored. Security uses cryptographic hash functions such as SHA-256, whose hash cannot be turned back into the input; md5() and sha1() are too fast and weak for passwords.

هەر نێوخستەیەک دەگۆڕێت بۆ نرخێکی کورتی قەبارە جێگیر کە پێی دەوترێت هاش؛ هەمان نێوخستە هەمیشە هەمان هاش دەدات. کرداری هاشی خێرا بەکار دەهێنێت بۆ ئەوەی بڕیار بدات هەر لە کوێ هەڵبگیرێت. ئاسایش کرداری هاشی شفرەیی بەکار دەهێنێت، وەک ⁦SHA-256⁩، کە هاشەکەی ناگەڕێتەوە بۆ نێوخستەکە؛ md5() و sha1() بۆ تێپەڕەوشە زۆر خێرا و لاوازن.

A hash function takes any input — one word or a whole film — and produces a short hash value of fixed length. NIST lists the properties that make it useful for security:

هەر وەردەگرێت — یەک وشە یان فیلمێکی تەواو — و کورت بە درێژییەکی جێگیر دروست دەکات. NIST ئەو تایبەتمەندییانە دەژمێرێت کە بۆ بەسوودی دەکەن:

  • Fixed length: SHA-256 always gives 256 bits (64 hexadecimal characters), whatever the input size.
  • One-way: from the hash value you cannot find the input. There is no key and no 'decrypt'.
  • Collision-resistant: it is practically impossible to find two different inputs with the same hash value.
  • Tiny change, totally different result: change one letter and about half the bits change.
  • درێژیی جێگیر: ⁦SHA-256⁩ هەمیشە ⁦256⁩ دەدات (⁦64⁩ )، قەبارەی هەرچییەک بێت.
  • یەک ئاراستە: لە ناتوانیت بدۆزیتەوە. هیچ کلیلێک و هیچ «»ێک نییە.
  • بەرگری لە : بە کردەیی مەحاڵە دوو جیاواز بدۆزیتەوە کە هەمان هەبێت.
  • گۆڕانی بچووک، ئەنجامی بە تەواوی جیاواز: یەک پیت بگۆڕە و نزیکەی نیوەی دەگۆڕێن.
SHA-256 of three almost identical words⁦SHA-256⁩ـی سێ وشەی نزیکەن لە یەکhashdemo.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
import hashlib

for text in ["HELLO", "HELLo", "HELLO!"]:
    digest = hashlib.sha256(text.encode()).hexdigest()
    print(f"{text:7} -> {digest}")

big = "A" * 1_000_000                      # one million letters
print("1 MB    ->", hashlib.sha256(big.encode()).hexdigest())
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 4

hashlib.sha256 is in Python's standard library; hexdigest() shows the hash value as hexadecimal.

hashlib.sha256 لە Pythonـدایە؛ hexdigest() بە شێوەی پیشان دەدات.

Lineدێڕی 7-8

A million letters still give 64 characters.

ملیۆنێک پیت هێشتا ⁦64⁩ دەدات.

Quick checkپشکنینی خێراWhat happens to the SHA-256 hash value if you change one letter of the input?ئەگەر یەک پیتی بگۆڕیت، ⁦SHA-256⁩ چی بەسەر دێت؟

What is a Cryptographic Hashing Function? (Example + Purpose)Whiteboard Crypto · Englishئینگلیزی · 157K viewsبینین · 5.9K likesلایک · Partبەشی 0:00–4:51 (ofلە 7:07)

A hash function as a fingerprint of data: same input same output, tiny change totally different output, one-way, and collisions.

وەک پەنجەمۆری : هەمان هەمیشە هەمان دەدات، گۆڕانێکی بچووک تەواو جیاواز دەدات، یەک ئاراستەیە، هەروەها چییە.

Plays 0:00-4:51; stops before the cryptocurrency mining part.

لە ⁦0:00⁩ تا ⁦4:51⁩ پەخش دەبێت؛ پێش بەشی دەرهێنانی (mining) ڕادەوەستێت.

Hashing: a fingerprint of the dataهاشکردن: پەنجەمۆری دراوە

Where hashes are used, and which ones are safeهاش لە کوێ بەکار دێت و کامیان سەلامەتە

Uses: a website publishes the hash value of a download, and you compare it with the hash of the file you received (integrity). Servers store hashes of passwords instead of the passwords themselves. Digital signatures sign the hash of a document. And a blockchain links its blocks with hashes, so changing an old entry breaks the chain (see Blocks chained by hashes).

بەکارهێنانەکان: فایلێکی دابەزاندن بڵاو دەکاتەوە و تۆ بەراوردی دەکەیت بە هاشی ئەو فایلەی وەرتگرتووە (). لە جیاتی خودی هاشەکانیان هەڵدەگرن. واژوو لەسەر هاشی بەڵگەنامەکە دەکەن. هەروەها خۆی بە هاش بە یەکەوە دەبەستێتەوە، بۆیە گۆڕینی تۆمارێکی کۆن زنجیرەکە دەپچڕێنێت (سەیری بلۆکەکان کە بە هاش بە یەکەوە بەستراون بکە).

Quick checkپشکنینی خێراYou download a program and its website shows a SHA-256 value. You compute the SHA-256 of your file and get a different value. What does that tell you? دادەبەزێنیت و نرخێکی ⁦SHA-256⁩ پیشان دەدات. ⁦SHA-256⁩ـی فایلەکەی خۆت حیساب دەکەیت و نرخێکی جیاوازت دەست دەکەوێت. ئەمە چیت پێ دەڵێت؟

Hashing: a fingerprint of the dataهاشکردن: پەنجەمۆری دراوە

Salts: storing passwords safelyخوێ: هەڵگرتنی تێپەڕەوشەکان بە سەلامەتی

A website should never store your password. It stores a hash: at login it hashes what you typed and compares the two hash values. But a plain fast hash is not enough. If Aram and Shilan both choose the same password, they get the same hash, and attackers who steal the database can compare it with ready-made lists of hashes of common passwords.

هەرگیز نابێت هەڵبگرێت. هاشێک هەڵدەگرێت: لە کاتی ئەوەی نووسیوتە هاش دەکات و هەردوو بەراورد دەکات. بەڵام هاشێکی خێرای سادە بەس نییە. ئەگەر ئارام و شیلان هەردووکیان هەمان هەڵبژێرن، هەمان هاشیان دەست دەکەوێت و کە دەدزن دەتوانن بەراوردی بکەن بە لیستی ئامادەکراوی هاشی باو.

The fix is a salt: a random value, different for every user, mixed with the password before hashing. The salt is stored next to the hash; it does not need to be secret. Its job is to make every hash unique, so ready-made lists are useless and every password must be attacked separately.

چارەسەرەکە ـە: نرخێکی هەڕەمەکی، جیاواز بۆ هەر ، کە پێش هاشکردن تێکەڵ بە دەکرێت. لە تەنیشت هاشەکە هەڵدەگیرێت؛ پێویست ناکات نهێنی بێت. کارەکەی ئەوەیە هەموو هاشێک تاک بکات، بۆ ئەوەی لیستە ئامادەکراوەکان بێسوود بن و هەموو بە جیا هێرشی بکرێتە سەر.

Same password, different salts, different hashesهەمان تێپەڕەوشە، خوێی جیاواز، هاشی جیاوازsaltdemo.pyPYTHONType in a terminalلە تێرمیناڵدا بینووسە
import hashlib, os

password = "kurdistan2026"
for user in ["aram", "shilan"]:
    salt = os.urandom(16)                  # 16 random bytes, new for every user
    h = hashlib.pbkdf2_hmac("sha256", password.encode(), salt, 600_000)
    print(user, "salt:", salt.hex()[:12] + "...", "hash:", h.hex()[:16] + "...")
Explain the codeڕوونکردنەوەی کۆدەکە
Lineدێڕی 5

os.urandom(16) makes 16 random bytes (128 bits), a new salt for each user.

os.urandom(16) شازدە هەڕەمەکی (⁦128⁩ ) دروست دەکات، نوێ بۆ هەر .

Lineدێڕی 6

PBKDF2 repeats the hash 600,000 times on purpose, so each guess costs an attacker real time.

⁦PBKDF2⁩ بە ئەنقەست هاشەکە ⁦600,000⁩ جار دووبارە دەکاتەوە، بۆ ئەوەی هەر هەوڵێکی تاقیکردنەوە کاتی ڕاستەقینەی بخوات.

Quick checkپشکنینی خێراWhy does a salt not need to be secret?بۆچی پێویست ناکات نهێنی بێت؟

Hashing: a fingerprint of the dataهاشکردن: پەنجەمۆری دراوە

Slow on purpose: the rules for storing passwordsبە ئەنقەست خاو: یاساکانی هەڵگرتنی تێپەڕەوشەکان

  • NIST SP 800-63B-4 says passwords shall be salted and hashed with a suitable password-hashing scheme, the salt at least 32 bits long, and the cost factor as high as practical.
  • OWASP recommends deliberately slow password-hashing algorithms: Argon2id first, then scrypt, bcrypt for older systems, or PBKDF2 where official FIPS approval is required. Plain SHA-256 is too fast: it lets an attacker test billions of guesses.
  • For the PHP code (password_hash(), which uses bcrypt and adds the salt automatically) see Storing passwords safely.
  • ⁦NIST SP 800-63B-4⁩ دەڵێت دەبێت خوێیان لێ بدرێت و هاش بکرێن بە شێوازێکی گونجاوی ، لانیکەم ⁦32⁩ بێت و تێچووی کارەکە ئەوەندەی بکرێت بەرز بێت.
  • OWASP پێشنیار دەکات کە بە ئەنقەست خاون: یەکەم ⁦Argon2id⁩، پاشان scrypt، bcrypt بۆ سیستەمە کۆنەکان، یان ⁦PBKDF2⁩ لە شوێنێک کە ڕەزامەندیی فەرمیی FIPS پێویستە. ⁦SHA-256⁩ـی سادە زۆر خێرایە: ڕێگە دەدات ملیارەها هەوڵ تاقی بکاتەوە.
  • بۆ کۆدی PHP (password_hash() کە bcrypt بەکار دەهێنێت و خۆکارانە زیاد دەکات) سەیری هەڵگرتنی تێپەڕەوشەکان بە سەلامەتی بکە.
Quick checkپشکنینی خێراWhy do OWASP and NIST want password hashing to be slow?بۆچی OWASP و NIST دەیانەوێت خاو بێت؟

Digital signatures: proving who sent itواژووە دیجیتاڵییەکان: سەلماندنی ئەوەی کێ ناردوویەتی

Definitionپێناسە

A code made from a message with the sender's private key. Anyone with the matching public key can check that the message really comes from the sender and was not changed.

کۆدێکە کە بە کلیلی تایبەتی نێرەر لە نامەیەک دروست دەکرێت. هەر کەسێک کلیلی گشتیی هاوتای هەبێت دەتوانێت بپشکنێت کە نامەکە بە ڕاستی لە نێرەرەکەوە هاتووە و نەگۆڕدراوە.

A digital signature uses the key pair the other way round. The sender signs with her private key; anyone can check the signature with her public key. In practice the sender hashes the document and signs the hash value. The receiver hashes the document again and uses the public key to check that the signature matches that hash.

جووتە کلیلەکە بە پێچەوانەوە بەکار دەهێنێت. نێرەر بە خۆی واژوو دەکات؛ هەر کەسێک دەتوانێت بە ئەو واژووەکە بپشکنێت. لە ڕاستیدا نێرەر بەڵگەنامەکە هاش دەکات و واژوو لەسەر دەکات. وەرگر دووبارە بەڵگەنامەکە هاش دەکات و بە دەپشکنێت ئایا واژووەکە لەگەڵ ئەو هاشەدا دەگونجێت.

  1. Sign (Shilan)واژووکردن (شیلان)

    Hash the document → sign the hash with Shilan's private key → send document + signature.

    بەڵگەنامەکە هاش بکە ← هاشەکە بە شیلان واژوو بکە ← بەڵگەنامە + واژوو بنێرە.

  2. Verify (anyone)پشکنین (هەر کەسێک)

    Hash the received document → check the signature with Shilan's public key → if it matches, the document is unchanged and came from Shilan.

    بەڵگەنامە وەرگیراوەکە هاش بکە ← واژووەکە بە شیلان بپشکنە ← ئەگەر گونجا، بەڵگەنامەکە نەگۆڕاوە و لە شیلانەوە هاتووە.

Quick checkپشکنینی خێراWhich key does Shilan use to sign a document?شیلان بە کام کلیل بەڵگەنامەیەک واژوو دەکات؟

Digital signatures: proving who sent itواژووە دیجیتاڵییەکان: سەلماندنی ئەوەی کێ ناردوویەتی

What a signature proves, and what it does notواژوو چی دەسەلمێنێت و چی ناسەلمێنێت

NIST lists what a signature gives: origin authentication (it came from the holder of that private key), data integrity (not one bit was changed) and non-repudiation (the signer cannot credibly deny signing). It does not give confidentiality: a signed message can still be read by anyone unless it is also encrypted.

NIST دەژمێرێت واژوو چی دەدات: سەرچاوە (لە خاوەنی هاتووە)، (تەنانەت یەک نەگۆڕاوە) و (واژووکەر ناتوانێت بە شێوەیەکی باوەڕپێکراو نکۆڵی لە واژووکردن بکات). نادات: نامەیەکی واژووکراو هێشتا هەر کەسێک دەتوانێت بیخوێنێتەوە، مەگەر شفرەش کرابێت.

The family sealمۆری خێزان

In the past an important letter was closed with the sender's personal seal. Everyone in town knew what the seal looked like, but only its owner had the seal ring. A broken or unknown seal meant: do not trust this letter.

لە ڕابردوودا نامەیەکی گرنگ بە مۆری تایبەتی نێرەرەکە دادەخرا. هەموو خەڵکی شارەکە دەیانزانی مۆرەکە چۆنە، بەڵام تەنها خاوەنەکەی ئەنگوستیلەی مۆرەکەی هەبوو. مۆرێکی شکاو یان نەناسراو واتای ئەوە بوو: متمانە بەم نامەیە مەکە.

Where the analogy stops workingسنووری ئەم نموونەیە

A wax seal looks the same on every letter, so it can be copied onto a forged letter. A digital signature is different for every document, because it depends on the document's hash value.

مۆری مۆم لەسەر هەموو نامەیەک وەک یەک دەردەکەوێت، بۆیە دەکرێت بخرێتە سەر نامەیەکی ساختە. بۆ هەر بەڵگەنامەیەک جیاوازە، چونکە پشت بە بەڵگەنامەکە دەبەستێت.

Signatures protect you every day: software updates are signed by their maker, so your phone refuses a fake update; and passkeys log you in by signing a random challenge from the website with a private key that never leaves your device (see Passkeys).

واژووەکان هەموو ڕۆژێک دەتپارێزن: لەلایەن دروستکەرەکەیانەوە واژوو دەکرێن، بۆیە مۆبایلەکەت ساختە ڕەت دەکاتەوە؛ هەروەها بە واژووکردنی داواکارییەکی هەڕەمەکیی بە کە هەرگیز ئامێرەکەت بەجێ ناهێڵێت دەتبەنە ژوورەوە (سەیری پاسکییەکان بکە).

Quick checkپشکنینی خێراA signed but unencrypted e-mail is intercepted. What can the eavesdropper do? واژووکراو بەڵام شفرەنەکراو دەگیرێت. گوێگرە دزەکییەکە چی دەتوانێت بکات؟

Certificates and TLS: the padlockبڕوانامە دیجیتاڵییەکان و TLS: قفڵەکە

Public keys raise one more question: when your browser receives a public key that claims to belong to your bank, how does it know it is not an attacker's key? The answer is a digital certificate.

پرسیارێکی تر دروست دەکەن: کاتێک وەردەگرێت کە دەڵێت هی بانکەکەتە، چۆن دەزانێت کلیلی نییە؟ وەڵامەکە ـە.

Definitionپێناسە

An electronic document, signed by a trusted organisation, that proves who owns a public key, for example that a website really belongs to a bank. uses it.

بەڵگەنامەیەکی ئەلیکترۆنییە کە دامەزراوەیەکی متمانەپێکراو واژووی کردووە و دەیسەلمێنێت کلیلێکی گشتی هی کێیە، بۆ نموونە کە تۆڕگەیەک بە ڕاستی هی بانکێکە. بەکاری دەهێنێت.

A certificate is a small file that binds a public key to a domain name, such as bank.example. It is digitally signed by a certificate authority (CA), an organisation that checks who controls the domain and that browsers already trust. Let's Encrypt, for example, issues certificates for free.

فایلێکی بچووکە کە بە دەبەستێتەوە، وەک bank.example. لەلایەن ـەوە ⁦(CA)⁩ بە دیجیتاڵی واژوو دەکرێت، ڕێکخراوێک کە دەپشکنێت کێ دۆمەینەکەی بەدەستە و پێشتر متمانەیان پێیەتی. بۆ نموونە ⁦Let's Encrypt⁩ بە خۆڕایی دەدات.

Quick checkپشکنینی خێراWhat does a certificate authority sign? واژوو لەسەر چی دەکات؟

SSL/TLS Explained in 7 MinutesSematext · Englishئینگلیزی · 279K viewsبینین · 6K likesلایک · Partبەشی 0:00–6:57 (ofلە 7:37)

Says plainly that SSL is old and gone, TLS replaced it, and people still say 'SSL' out of habit; then why HTTPS encryption matters.

بە ڕوونی دەڵێت SSL کۆنە و نەماوە و TLS جێگەی گرتۆتەوە، بەڵام خەڵک لەبەر ڕاهاتن هێشتا دەڵێن «SSL». پاشان ڕوونی دەکاتەوە بۆچی گرنگە.

Plays 0:00-6:57; stops before the monitoring product.

لە ⁦0:00⁩ تا ⁦6:57⁩ پەخش دەبێت؛ پێش ناساندنی بەرهەمی چاودێریی کۆمپانیاکە ڕادەوەستێت.

Certificates and TLS: the padlockبڕوانامە دیجیتاڵییەکان و TLS: قفڵەکە

The TLS handshakeتەوقەکردنی TLS

The TLS handshake in four steps (TLS 1.3, simplified)تەوقەکردنی TLS لە چوار هەنگاودا (⁦TLS 1.3⁩، بە سادەیی)
  1. Helloسڵاو

    The browser lists the TLS versions and algorithms (cipher suites) it supports and already sends its half of a key exchange. The server picks one suite and answers with its own half.

    ئەو وەشانانەی TLS و ئەو پشتگیرییان دەکات لیست دەکات (کۆمەڵەکانی ) و هەر لە سەرەتاوە نیوەی خۆی لە ئاڵوگۆڕی کلیل دەنێرێت. یەکێک لە کۆمەڵەکان هەڵدەبژێرێت و نیوەی خۆی دەنێرێتەوە.

  2. Agree on a keyڕێککەوتن لەسەر کلیل

    From the two halves both sides compute the same fresh session key (a Diffie–Hellman exchange). An eavesdropper who saw both halves still cannot compute it.

    هەردوو لا لە دوو نیوەکەوە هەمان کلیلی دانیشتنی نوێ حیساب دەکەن (ئاڵوگۆڕی ⁦Diffie–Hellman⁩). گوێگرێکی دزەکی کە هەردوو نیوەکەی بینیوە هێشتا ناتوانێت حیسابی بکات.

  3. Prove identityسەلماندنی ناسنامە

    The server sends its certificate and signs the handshake with its private key. The browser checks the CA's signature, the domain name and the expiry date, then checks the server's signature with the public key in the certificate.

    دەنێرێت و تەوقەکردنەکە بە واژوو دەکات. واژووی CAـیەکە، و بەرواری بەسەرچوونەکە دەپشکنێت، پاشان بە — کە لە نووسراوە — واژووەکەی دەپشکنێت.

  4. Talk securelyقسەکردنی پارێزراو

    Everything after that — pages, passwords, cookies — is encrypted with fast symmetric encryption and protected against changes.

    هەموو شتێک دوای ئەوە — پەڕەکان، ، — بە خێرا شفرە دەکرێت و لە گۆڕان دەپارێزرێت.

TLS gives the three things this lesson started with: confidentiality (encryption), integrity (changes are detected) and authenticity (the certificate proves the server). Which TLS versions are current, why people still say 'SSL', and what the padlock does and does not promise are explained in The padlock today: TLS, not SSL.

TLS ئەو سێ شتە دەدات کە ئەم وانەیە پێی دەستی پێکرد: ()، (گۆڕانەکان دەدۆزرێنەوە) و ( دەسەلمێنێت). کام وەشانی TLS ئێستا بەکار دێت، بۆچی خەڵک هێشتا دەڵێن «SSL» و قفڵەکە چی بەڵێن دەدات و چی نادات، لە قفڵەکە ئەمڕۆ: TLS، نەک SSL ڕوون کراونەتەوە.

Quick checkپشکنینی خێراAn attacker copies a bank's certificate (certificates are public) onto his own server. Why does the browser still refuse his server? بانکێک کۆپی دەکات بۆ سەر خۆی ( ئاشکران). بۆچی هێشتا ئەو ڕەت دەکاتەوە؟

In transit, at rest and end to endلە گواستنەوەدا، وەستاو و سەرتاسەری

Data needs protection in two states, and in one special case:

لە دوو دۆخدا پاراستنی پێویستە، هەروەها لە بارێکی تایبەتدا:

StateدۆخWhat is protectedچی دەپارێزرێتExamplesنموونەWho can still read itکێ هێشتا دەتوانێت بیخوێنێتەوە
In transitData moving over a network لە کاتی جووڵە بە TLS (HTTPS), a VPN, Wi-Fi encryptionTLS ()، VPN، Both ends, and the servers in between that end the TLS connection (e.g. the e-mail provider)هەردوو سەر و ئەو لە نێوانیاندا کە پەیوەندیی TLS کۆتایی پێ دەهێنن (بۆ نموونە دابینکەری ئیمەیڵ)
At restData stored on a disk, phone, database or backup هەڵگیراو لەسەر دیسک، مۆبایل، یان Full-disk encryption on laptops and phones, encrypted database files هەموو دیسک لە لاپتۆپ و مۆبایلدا، فایلی شفرەکراوی بنکەدراوەWhoever unlocks the device or has the keyهەر کەسێک ئامێرەکە بکاتەوە یان کلیلەکەی هەبێت
End-to-endA message from one user's device to another'sنامەیەک لە ئامێری بۆ ئامێری یەکێکی ترMessaging apps that encrypt on the sender's phone and decrypt only on the receiver'sئەپی نامەناردن کە لەسەر مۆبایلی نێرەر شفرە دەکەن و تەنها لەسەر مۆبایلی وەرگر دەیکەنەوەOnly the two users — not even the company that runs the serviceتەنها هەردوو — تەنانەت کۆمپانیای خاوەنی خزمەتگوزارییەکەش نا
Quick checkپشکنینی خێراA thief steals a laptop with full-disk encryption, but not its password. What does he get?دزێک لاپتۆپێک کە هەموو دیسکی هەیە دەدزێت، بەڵام نا. چی دەست دەکەوێت؟

Common mistakesهەڵە باوەکان

MistakeهەڵەWhy it is wrongبۆچی هەڵەیەDo this insteadلە جیاتی ئەوە ئەمە بکە
"Hashing is a kind of encryption."«هاشکردن جۆرێکە لە .»Encryption can be undone with the key; a hash has no key and cannot be undone. بە کلیل دەگەڕێندرێتەوە؛ هاش هیچ کلیلێکی نییە و ناگەڕێندرێتەوە.Encrypt what you must read again; hash (with a salt) what you only need to check, like passwords.ئەوەی دەبێت دووبارە بیخوێنیتەوە شفرەی بکە؛ ئەوەی تەنها پێویستە بیپشکنیت، وەک ، (بە ) هاشی بکە.
"Base64 hides my data."«⁦Base64⁩ دەشارێتەوە.»Encoding has no key; anyone can decode it. کلیلی نییە؛ هەر کەسێک دەتوانێت بیگەڕێنێتەوە.Use real encryption such as AES. ڕاستەقینەی وەک AES بەکار بهێنە.
"I wrote my own secret cipher, so it is safe."« نهێنیی خۆم نووسیوە، بۆیە سەلامەتە.»Home-made ciphers are almost always broken quickly; secrecy of the method is not security. دەستکرد نزیکەی هەمیشە بە خێرایی دەشکێنرێن؛ نهێنیی ڕێگاکە نییە.Use public, tested standards (AES, TLS); keep only the key secret.ستانداردی ئاشکرا و تاقیکراو بەکار بهێنە (AES، TLS)؛ تەنها کلیلەکە نهێنی بهێڵەرەوە.
"Asymmetric means the private key is shared."«ناهاوچەشن واتە هاوبەش دەکرێت.»Only the public key is shared. A private key that leaves its owner is no longer private.تەنها هاوبەش دەکرێت. کە خاوەنەکەی بەجێ بهێڵێت ئیتر تایبەت نییە.Encrypt with the receiver's public key; sign with your own private key.بە وەرگر شفرە بکە؛ بە خۆت واژوو بکە.
"Storing the key next to the encrypted file is fine."«هەڵگرتنی کلیلەکە لە تەنیشت فایلە شفرەکراوەکە کێشە نییە.»Whoever steals the file steals the key too.هەر کەسێک فایلەکە بدزێت کلیلەکەش دەدزێت.Keep keys separately, ideally in special key storage.کلیلەکان بە جیا هەڵبگرە، باشترە لە شوێنی تایبەتی هەڵگرتنی کلیل.
"MD5 or plain SHA-256 is fine for passwords."«⁦MD5⁩ یان ⁦SHA-256⁩ـی سادە بۆ باشە.»MD5 is broken and both are fast, so stolen hashes are guessed quickly.⁦MD5⁩ شکاوە و هەردووکیان خێران، بۆیە هاشە دزراوەکان بە خێرایی دەدۆزرێنەوە.Salted, slow password hashing: Argon2id, scrypt, bcrypt or PBKDF2. خاو بە : ⁦Argon2id⁩، scrypt، bcrypt یان ⁦PBKDF2⁩.
"The padlock means the site is honest."«قفڵەکە واتە ڕاستگۆیە.»It means only that the connection is encrypted to whoever owns that address; phishing sites have padlocks too.تەنها واتای ئەوەیە پەیوەندییەکە بۆ خاوەنی ئەو ناونیشانە شفرە کراوە؛ قفڵیان هەیە.Read the address, as explained in the padlock lesson.ناونیشانەکە بخوێنەرەوە، وەک لە وانەی قفڵەکەدا ڕوون کراوەتەوە.

Exercisesڕاهێنانەکان

ExerciseڕاهێنانDecrypt by handبە دەست بیکەرەوە

A friend sends you FBEHU VHFXULWB encrypted with the Caesar cipher and key 3. Decrypt it with the formula D(c)=(c−3) mod 26D(c) = (c - 3) \bmod 26.

هاوڕێیەک FBEHU VHFXULWBت بۆ دەنێرێت کە بە و کلیلی 3 شفرە کراوە. بە هاوکێشەی D(c)=(c−3) mod 26D(c) = (c - 3) \bmod 26 بیکەرەوە.

Hintئاماژە

B is number 1. Going back three places from B wraps round past A to the end of the alphabet.

B ژمارە 1ـە. سێ شوێن گەڕانەوە لە Bـەوە بە Aـدا تێدەپەڕێت و دەگاتە کۆتایی ئەلفوبێ.

Show answerوەڵامەکە پیشان بدە

Move every letter three places back: F→C, B→Y, E→B, H→E, U→R, and so on. The only tricky letter is B, number 1: (1−3) mod 26=24(1 - 3) \bmod 26 = 24, which is Y. The plaintext is CYBER SECURITY.

هەموو پیتێک سێ شوێن بگەڕێنەرەوە دواوە: F→C، B→Y، E→B، H→E، U→R و هتد. تاکە پیتی سەخت Bـە کە ژمارە 1ـە: (1−3) mod 26=24(1 - 3) \bmod 26 = 24 کە دەکاتە Y. ⁦CYBER SECURITY⁩ـە.

ExerciseڕاهێنانBreak it without the keyبەبێ کلیل بیشکێنە

You intercept ZHOFRPH WR NXUGLVWDQ. You know it is a Caesar cipher but not the key. How would you find the message, and how many tries do you need at most? What is the message?

ZHOFRPH WR NXUGLVWDQ دەگریت. دەزانیت بەڵام کلیلەکە نازانیت. چۆن نامەکە دەدۆزیتەوە و لانی زۆر چەند هەوڵت پێویستە؟ نامەکە چییە؟

Show answerوەڵامەکە پیشان بدە

Try all 25 keys (a brute-force attack), exactly like caesar_brute.py, and keep the only line that is readable. At most 25 tries. With key 3 the message is WELCOME TO KURDISTAN. A short word like WR (TO) is a good clue: there are not many two-letter words.

هەر ⁦25⁩ کلیلەکە تاقی بکەرەوە () ڕێک وەک caesar_brute.py. پاشان تەنها ئەو دێڕە بهێڵەرەوە کە دەخوێندرێتەوە. لانی زۆر ⁦25⁩ هەوڵ. بە کلیلی 3 نامەکە ⁦WELCOME TO KURDISTAN⁩ـە. وشەیەکی کورتی وەک WR ⁦(TO)⁩ نیشانەیەکی باشە: وشەی دوو پیتی زۆر نین.

ExerciseڕاهێنانChoose the right toolئامرازی ڕاست هەڵبژێرە

For each job, choose symmetric encryption, asymmetric encryption, hashing (with a salt) or a digital signature: (a) a website stores its users' passwords; (b) you encrypt the whole disk of your laptop; (c) a company proves that an app update really comes from it; (d) you send a secret file to someone you have never met and who has published a public key.

بۆ هەر کارێک، ، ، هاشکردن (بە ) یان هەڵبژێرە: (أ) هەڵدەگرێت؛ (ب) هەموو دیسکی لاپتۆپەکەت شفرە دەکەیت؛ (ج) کۆمپانیایەک دەیسەلمێنێت کە ئەپێک بە ڕاستی لە خۆیەوە هاتووە؛ (د) فایلێکی نهێنی دەنێریت بۆ کەسێک کە هەرگیز نەتبینیوە و بڵاو کردووەتەوە.

Show answerوەڵامەکە پیشان بدە
  • (a) Hashing with a salt, using a slow password-hashing algorithm. The site never needs to read the password again, only to check it.
  • (b) Symmetric encryption (AES): it is fast, and you are the only person who needs the key, so there is no sharing problem.
  • (c) A digital signature with the company's private key; the phone checks it with the company's public key.
  • (d) Asymmetric encryption with the receiver's public key — in practice used to protect a symmetric key that encrypts the file itself.
  • (أ) هاشکردن بە ، بە خاوی . هەرگیز پێویستی بە خوێندنەوەی نییە، تەنها پشکنینی.
  • (ب) ⁦(AES)⁩: خێرایە و تەنها تۆ کلیلەکەت پێویستە، بۆیە کێشەی هاوبەشکردن نییە.
  • (ج) بە کۆمپانیاکە؛ مۆبایلەکە بە کۆمپانیاکە دەیپشکنێت.
  • (د) بە وەرگرەکە — لە ڕاستیدا بۆ پاراستنی هاوچەشن بەکار دێت کە خودی فایلەکە شفرە دەکات.
ExerciseڕاهێنانExplain to a friendبۆ هاوڕێیەک ڕوونی بکەرەوە

Your friend says: 'If the website stores the salt right next to my hash, a thief gets both, so the salt is useless.' Is your friend right?

هاوڕێکەت دەڵێت: «ئەگەر ڕێک لە تەنیشت هاشەکەم هەڵبگرێت، دز هەردووکیان دەبات، بۆیە بێسوودە.» هاوڕێکەت ڕاست دەکات؟

Show answerوەڵامەکە پیشان بدە

No. The salt was never meant to be secret. It makes each user's hash unique, so the thief cannot use ready-made lists of hashes and cannot crack many accounts at once; he must attack each password separately with a slow algorithm. That buys time to warn users and reset passwords. (A separate secret, sometimes called a pepper, can be kept away from the database as an extra layer.)

نەخێر. هەرگیز بۆ نهێنی بوون نەبووە. هاشی هەر تاک دەکات، بۆیە دزەکە ناتوانێت لیستی ئامادەکراوی هاش بەکار بهێنێت و ناتوانێت لە یەک کاتدا زۆر هەژمار بشکێنێت؛ دەبێت بە خاو هێرش بکاتە سەر هەر بە جیا. ئەمە کات دەداتە ئاگادارکردنەوەی و گۆڕینی . (نهێنییەکی جیا کە هەندێک جار پێی دەگوترێت بیبەر، دەکرێت وەک چینێکی زیادە دوور لە هەڵبگیرێت.)

Summary and reviewپوختە و پێداچوونەوە

  • Encryption turns plaintext into ciphertext with an algorithm and a key; decryption reverses it. The algorithm is public; the key is the secret.
  • The Caesar cipher (Ek(m)=(m+k) mod 26E_k(m) = (m + k) \bmod 26) shows the idea and its weakness: only 25 keys, so brute force breaks it at once. AES has at least 21282^{128} keys.
  • Symmetric: one shared key, fast (AES), but the key must be shared. Asymmetric: public + private key pair, slower (RSA, elliptic curves), solves key sharing. Real systems combine them.
  • A hash function gives a fixed-length, one-way fingerprint; tiny changes give a completely different value. Passwords are stored salted and hashed with a slow algorithm.
  • A digital signature (private key signs, public key verifies) gives authenticity, integrity and non-repudiation, not confidentiality. Certificates, signed by CAs, bind public keys to domain names; TLS uses all of these.
  • Protect data in transit (TLS, VPN), at rest (disk and database encryption) and, for messages, end to end.
  • بە و کلیلێک دەگۆڕێت بۆ ؛ پێچەوانەکەی دەکات. ئاشکرایە؛ کلیلەکە نهێنییەکەیە.
  • (Ek(m)=(m+k) mod 26E_k(m) = (m + k) \bmod 26) بیرۆکەکە و لاوازییەکەی پیشان دەدات: تەنها ⁦25⁩ کلیل، بۆیە یەکسەر دەیشکێنێت. AES لانیکەم 21282^{128} کلیلی هەیە.
  • هاوچەشن: یەک کلیلی هاوبەش، خێرا ⁦(AES)⁩، بەڵام کلیلەکە دەبێت هاوبەش بکرێت. ناهاوچەشن: جووتێک کلیل ( و )، خاوتر (RSA، چەماوەی ئێلیپتیکی)، کێشەی هاوبەشکردنی کلیل چارەسەر دەکات. سیستەمە ڕاستەقینەکان تێکەڵیان دەکەن.
  • پەنجەمۆرێکی یەک ئاراستە بە درێژیی جێگیر دەدات؛ گۆڕانی بچووک نرخێکی بە تەواوی جیاواز دەدات. بە و هاشێکی خاو هەڵدەگیرێن.
  • ( واژوو دەکات، دەیپشکنێت) ، و دەدات، نەک . کە CA واژوویان دەکات بە دەبەستنەوە؛ TLS هەموو ئەمانە بەکار دەهێنێت.
  • لە گواستنەوەدا (TLS، )، لە دۆخی وەستاودا ( دیسک و ) و بۆ نامەکان بە شێوەی سەرتاسەری بپارێزە.
Review questionsپرسیارەکانی پێداچوونەوە
Why is the Caesar cipher called symmetric?بۆچی بە شفرەی قەیسەر دەگوترێت هاوچەشن؟

Because the same key (the shift) is used to encrypt and to decrypt.

چونکە هەمان کلیل (ژمارەی جووڵەکە) بۆ شفرەکردن و کردنەوە بەکار دێت.

Which key opens a message encrypted with Shilan's public key?کام کلیل نامەیەک دەکاتەوە کە بە کلیلی گشتیی شیلان شفرە کراوە؟

Only Shilan's private key.

تەنها شیلان.

Name two differences between a hash and encryption.دوو جیاوازیی نێوان هاش و شفرەکردن بڵێ.

A hash has no key and cannot be reversed; its output always has the same length. Encryption uses a key and can be reversed, and its output grows with the input.

هاش کلیلی نییە و ناگەڕێندرێتەوە؛ ئەنجامەکەی هەمیشە هەمان درێژیی هەیە. کلیل بەکار دەهێنێت و دەگەڕێندرێتەوە و ئەنجامەکەی لەگەڵ گەورە دەبێت.

What does a browser check in a server's certificate?تۆڕگەڕ چی لە بڕوانامەی دیجیتاڵیی ڕاژەکاردا دەپشکنێت؟

That a trusted certificate authority signed it, that it is for the domain in the address bar, and that it has not expired.

ئەوەی متمانەپێکراو واژووی کردووە، ئەوەی بۆ ئەو دۆمەینەیە کە لە شریتی ناونیشانەکەدایە و ئەوەی بەسەرنەچووە.

Videoڤیدیۆ

Watch a videoسەیری ڤیدیۆیەک بکە

A video that viewers liked a lot and praised in their comments, chosen for this lesson.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.

Cryptography: Crash Course Computer Science #33CrashCourse · Englishئینگلیزی · 995K viewsبینین · 20K likesلایک

From substitution ciphers like Caesar's to AES, one-way functions, key exchange and public-key encryption, in one clear story.

لە ، وەک ، تا AES، یەک ئاراستە، ئاڵوگۆڕکردنی و ، لە یەک چیرۆکی ڕووندا.

Whole video (12:33): classic ciphers, AES, key exchange, symmetric vs asymmetric.

هەموو ڤیدیۆکە ⁦(12:33)⁩: ، AES، ئاڵوگۆڕکردنی ، هەروەها بەرامبەر .

Lesson complete!وانەکە تەواو بوو!

Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.

Key termsزاراوە سەرەکییەکان

Next lessonوانەی داهاتوو

Where Vulnerabilities Come Fromخاڵە لاوازەکان لە کوێوە دێن

References and further readingسەرچاوەکان و خوێندنەوەی زیاتر

This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.