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؛ هەروەها لە گواستنەوەدا، لە دۆخی وەستاودا و بە شێوەی سەرتاسەری.
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 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.
زەرفێکی ڕاستەقینە دزێکی بە ئارام دەتوانێت بە هەڵم بیکاتەوە. باش بەبێ کلیلەکە ناکرێتەوە، تەنانەت ئەگەر هەموو جیهان چەندین ساڵ کاری بۆ بکەن.
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 و ئامانجە زیادەکانیدا بینیت. ئەم وانەیە ئەو ئامرازانە پیشان دەدات کە دەیانگەیەننە ئەو ئامانجانە.
Plaintext, ciphertext and the keyدەقی ئاشکرا، دەقی شفرەکراو و کلیل
Five words appear in every explanation of encryption. Learn them once:
پێنج وشە لە هەموو ڕوونکردنەوەیەکی دەردەکەون. یەک جار فێریان ببە:
| Wordوشە | Meaningواتا | Exampleنموونە |
|---|---|---|
| Plaintext | The readable message.نامە خوێندراوەکە. | HELLO |
| Ciphertext | The scrambled result. It looks like nonsense.ئەنجامە تێکەڵکراوەکە. وەک قسەی بێمانا دەردەکەوێت. | KHOOR |
| Cipher (algorithm) () | The method: the rule for scrambling and unscrambling.ڕێگاکە: ڕێسای تێکەڵکردن و کردنەوە. | "Move every letter forward"«هەموو پیتێک بەرەو پێش ببە» |
| Key | The 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، دامەزراوەی ستانداردەکانی ئەمریکا، بە سادەیی پێناسە دەکات: گۆڕینی بۆ بە بەکارهێنانی و کلیلێک. دەکرێت ئاشکرا بێت؛ کلیلەکە دەبێت نهێنی بمێنێتەوە.


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 شوێن بیگەڕێنەرەوە دواوە.
| Plain | A | B | C | D | E | F | G | H | I | J | K | L | M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Cipher (key 3) (کلیلی 3) | D | E | F | G | H | I | J | K | L | M | N | O | P |
| Plain | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
| Cipher (key 3) (کلیلی 3) | Q | R | S | T | U | V | W | X | Y | Z | A | B | C |
Mathematicians number the letters . 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:
بیرکاریزانەکان پیتەکان ژمارە دەکەن: . ئەوکات و دوو هاوکێشەی کورتن. mod 26 واتە « دوای دابەشکردن بەسەر 26دا وەربگرە»، ئەمەیە کە وا دەکات Z بگەڕێتەوە بۆ A:
is the number of a plaintext letter, the number of a ciphertext letter, the key. For example, with : X is 23, and , which is A.
ژمارەی پیتێکی ، ژمارەی پیتێکی و کلیلەکەیە. بۆ نموونە، بە : ژمارەی X دەکاتە 23 و کە دەکاتە A.
- Write the letters as numbersپیتەکان وەک ژمارە بنووسە
- Add the key 3کلیلی 3 زیاد بکە
- Take mod 26mod 26 وەربگرە
; the others stay: .
؛ ئەوانی تر وەک خۆیان دەمێننەوە: .
- Turn the numbers back into lettersژمارەکان بکەرەوە بە پیت
FBEHU. SoCYBERencrypts toFBEHU.FBEHU. کەواتەCYBERدەبێتەFBEHU.
In Kurdish: the Caesar cipher, C = (P + k) mod 26 and P = (C - k) mod 26, with worked examples.
بە کوردی: ، و ، لەگەڵ نموونەی هەنگاو بە هەنگاو.
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 نامەیەک شفرە دەکات، بە کلیلە ڕاستەکە دەیکاتەوە و پیشانی دەدات کلیلی هەڵە چی دەدات.
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))Ciphertext: PHHW DW WKH WHD KRXVH Decrypted: MEET AT THE TEA HOUSE Wrong key: LDDS ZS SGD SDZ GNTRD
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.
کلیلی هەڵە قسەی بێمانا دەدات، بەڵام سەرنج بدە هێشتا پیت و بۆشاییە: درێژیی وشەکان ئاشکرا دەبن.
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یان تاقی دەکاتەوە. ئەمە ـە. لە کەمتر لە میلیچرکەیەکدا دەیکات:
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)}")key 1: OGGV CV VJG VGC JQWUG key 2: NFFU BU UIF UFB IPVTF key 3: MEET AT THE TEA HOUSE key 4: LDDS ZS SGD SDZ GNTRD key 5: KCCR YR RFC RCY FMSQC key 6: JBBQ XQ QEB QBX ELRPB key 7: IAAP WP PDA PAW DKQOA key 8: HZZO VO OCZ OZV CJPNZ key 9: GYYN UN NBY NYU BIOMY key 10: FXXM TM MAX MXT AHNLX key 11: EWWL SL LZW LWS ZGMKW key 12: DVVK RK KYV KVR YFLJV key 13: CUUJ QJ JXU JUQ XEKIU key 14: BTTI PI IWT ITP WDJHT key 15: ASSH OH HVS HSO VCIGS key 16: ZRRG NG GUR GRN UBHFR key 17: YQQF MF FTQ FQM TAGEQ key 18: XPPE LE ESP EPL SZFDP key 19: WOOD KD DRO DOK RYECO key 20: VNNC JC CQN CNJ QXDBN key 21: UMMB IB BPM BMI PWCAM key 22: TLLA HA AOL ALH OVBZL key 23: SKKZ GZ ZNK ZKG NUAYK key 24: RJJY FY YMJ YJF MTZXJ key 25: QIIX EX XLI XIE LSYWI
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 هەیە. تەنانەت بچووکترینیان دەدات
That is how many keys there are. A computer trying a million million () keys every second would need about years to try them all: hundreds of millions of times the age of the universe.
ئەمە ژمارەی کلیلەکانە. کە لە هەر چرکەیەکدا ملیۆن ملیۆن () کلیل تاقی بکاتەوە، نزیکەی ساڵی پێویستە بۆ تاقیکردنەوەی هەموویان: سەدان ملیۆن جار تەمەنی گەردوون.
The oldest example: the Caesar cipherکۆنترین نموونە: شفرەی قەیسەر
Patterns leak, and the method is not the secretشێوازەکان دزە دەکەن و ڕێگاکە نهێنییەکە نییە
Symmetric encryption: one shared keyشفرەکردنی هاوچەشن: یەک کلیلی هاوبەش
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 شفرە دەکات.
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.
- خاڵی بەهێز: زۆر خێرایە. مۆبایلەکەت دەتوانێت فیلمێکی تەواو لە چەند چرکەیەکدا شفرە بکات، بۆیە بۆ دیسک، و زۆربەی هەموو پەڕەیەکی وێبی پارێزراو بەکار دێت.
- خاڵی لاواز — هاوبەشکردنی کلیل: هەردوو کەس پێش قسەکردن پێویستیان بە هەمان کلیلی نهێنی هەیە. ئەگەر کلیلەکە بە هەمان کراوەدا بنێریت، گوێگرە دزەکییەکەش کۆپیی دەکات. هەروەها لەگەڵ زۆر کەسدا زۆر کلیلت پێویستە: هەر جووتێک کلیلێکی جیای بۆ خۆی دەوێت.
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.
کلیلی دوکان دەکرێت ڕوو بە ڕوو بدرێت. دوو لە دوو سەری جیهان زۆربەی کات ناتوانن یەکتر ببینن؛ پەڕەی داهاتوو پیشان دەدات چۆن ئەم کێشەیە چارەسەر دەکەن.
Asymmetric encryption: a public key and a private keyشفرەکردنی ناهاوچەشن: کلیلی گشتی و کلیلی تایبەت
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 و چەماوەی ئێلیپتیکی ناسراوترین ڕێگاکانن.
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تایبەتمەندی | Symmetric | Asymmetric |
|---|---|---|
| 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نموونە | AES | RSA, elliptic curvesRSA، چەماوەی ئێلیپتیکی |
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 لە خوارەوە پیشانی دەدات.
Asymmetric encryption: a public key and a private keyشفرەکردنی ناهاوچەشن: کلیلی گشتی و کلیلی تایبەت
Looking ahead: quantum computersسەیرکردنی داهاتوو: کۆمپیوتەرە کوانتەمییەکان
Hashing: a fingerprint of the dataهاشکردن: پەنجەمۆری دراوە
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 )، قەبارەی هەرچییەک بێت.
- یەک ئاراستە: لە ناتوانیت بدۆزیتەوە. هیچ کلیلێک و هیچ «»ێک نییە.
- بەرگری لە : بە کردەیی مەحاڵە دوو جیاواز بدۆزیتەوە کە هەمان هەبێت.
- گۆڕانی بچووک، ئەنجامی بە تەواوی جیاواز: یەک پیت بگۆڕە و نزیکەی نیوەی دەگۆڕێن.
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())HELLO -> 3733cd977ff8eb18b987357e22ced99f46097f31ecb239e878ae63760e83e4d5 HELLo -> 7591eb0d9700bcb8ced5f5f0053c4b3df559a19aa855f92ba054f56ea6b2ec44 HELLO! -> a2f6017f1fab81333a4288f68557b74495a27337c7d37b3eba46c866aa885098 1 MB -> e23c0cda5bcdecddec446b54439995c7260c8cdcf2953eec9f5cdb6948e5898d
Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 4
hashlib.sha256is 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 دەدات.
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).
بەکارهێنانەکان: فایلێکی دابەزاندن بڵاو دەکاتەوە و تۆ بەراوردی دەکەیت بە هاشی ئەو فایلەی وەرتگرتووە (). لە جیاتی خودی هاشەکانیان هەڵدەگرن. واژوو لەسەر هاشی بەڵگەنامەکە دەکەن. هەروەها خۆی بە هاش بە یەکەوە دەبەستێتەوە، بۆیە گۆڕینی تۆمارێکی کۆن زنجیرەکە دەپچڕێنێت (سەیری بلۆکەکان کە بە هاش بە یەکەوە بەستراون بکە).
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.
چارەسەرەکە ـە: نرخێکی هەڕەمەکی، جیاواز بۆ هەر ، کە پێش هاشکردن تێکەڵ بە دەکرێت. لە تەنیشت هاشەکە هەڵدەگیرێت؛ پێویست ناکات نهێنی بێت. کارەکەی ئەوەیە هەموو هاشێک تاک بکات، بۆ ئەوەی لیستە ئامادەکراوەکان بێسوود بن و هەموو بە جیا هێرشی بکرێتە سەر.
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] + "...")aram salt: 52ad7d65caca... hash: a3ce6de1f21a8b7b... shilan salt: 94b37539bbbf... hash: 338a785145309c6a...
The salts are random, so your output will be different every time you run it.
هەڕەمەکین، بۆیە ئەنجامەکەت هەر جارێک کە کاری پێ دەکەیت جیاواز دەبێت.
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 جار دووبارە دەکاتەوە، بۆ ئەوەی هەر هەوڵێکی تاقیکردنەوە کاتی ڕاستەقینەی بخوات.
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 بەکار دەهێنێت و خۆکارانە زیاد دەکات) سەیری هەڵگرتنی تێپەڕەوشەکان بە سەلامەتی بکە.
Digital signatures: proving who sent itواژووە دیجیتاڵییەکان: سەلماندنی ئەوەی کێ ناردوویەتی
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.
جووتە کلیلەکە بە پێچەوانەوە بەکار دەهێنێت. نێرەر بە خۆی واژوو دەکات؛ هەر کەسێک دەتوانێت بە ئەو واژووەکە بپشکنێت. لە ڕاستیدا نێرەر بەڵگەنامەکە هاش دەکات و واژوو لەسەر دەکات. وەرگر دووبارە بەڵگەنامەکە هاش دەکات و بە دەپشکنێت ئایا واژووەکە لەگەڵ ئەو هاشەدا دەگونجێت.
- Sign (Shilan)واژووکردن (شیلان)
Hash the document → sign the hash with Shilan's private key → send document + signature.
بەڵگەنامەکە هاش بکە ← هاشەکە بە شیلان واژوو بکە ← بەڵگەنامە + واژوو بنێرە.
- 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.
بەڵگەنامە وەرگیراوەکە هاش بکە ← واژووەکە بە شیلان بپشکنە ← ئەگەر گونجا، بەڵگەنامەکە نەگۆڕاوە و لە شیلانەوە هاتووە.
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 دەژمێرێت واژوو چی دەدات: سەرچاوە (لە خاوەنی هاتووە)، (تەنانەت یەک نەگۆڕاوە) و (واژووکەر ناتوانێت بە شێوەیەکی باوەڕپێکراو نکۆڵی لە واژووکردن بکات). نادات: نامەیەکی واژووکراو هێشتا هەر کەسێک دەتوانێت بیخوێنێتەوە، مەگەر شفرەش کرابێت.
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).
واژووەکان هەموو ڕۆژێک دەتپارێزن: لەلایەن دروستکەرەکەیانەوە واژوو دەکرێن، بۆیە مۆبایلەکەت ساختە ڕەت دەکاتەوە؛ هەروەها بە واژووکردنی داواکارییەکی هەڕەمەکیی بە کە هەرگیز ئامێرەکەت بەجێ ناهێڵێت دەتبەنە ژوورەوە (سەیری پاسکییەکان بکە).
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.
پرسیارێکی تر دروست دەکەن: کاتێک وەردەگرێت کە دەڵێت هی بانکەکەتە، چۆن دەزانێت کلیلی نییە؟ وەڵامەکە ـە.
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 بە خۆڕایی دەدات.
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
- 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 و ئەو پشتگیرییان دەکات لیست دەکات (کۆمەڵەکانی ) و هەر لە سەرەتاوە نیوەی خۆی لە ئاڵوگۆڕی کلیل دەنێرێت. یەکێک لە کۆمەڵەکان هەڵدەبژێرێت و نیوەی خۆی دەنێرێتەوە.
- 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). گوێگرێکی دزەکی کە هەردوو نیوەکەی بینیوە هێشتا ناتوانێت حیسابی بکات.
- 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ـیەکە، و بەرواری بەسەرچوونەکە دەپشکنێت، پاشان بە — کە لە نووسراوە — واژووەکەی دەپشکنێت.
- 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 ڕوون کراونەتەوە.
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 transit | Data 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 rest | Data 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-end | A 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تەنها هەردوو — تەنانەت کۆمپانیای خاوەنی خزمەتگوزارییەکەش نا |
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ڕاهێنانەکان
A friend sends you FBEHU VHFXULWB encrypted with the Caesar cipher and key 3. Decrypt it with the formula .
هاوڕێیەک FBEHU VHFXULWBت بۆ دەنێرێت کە بە و کلیلی 3 شفرە کراوە. بە هاوکێشەی بیکەرەوە.
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: , which is Y. The plaintext is CYBER SECURITY.
هەموو پیتێک سێ شوێن بگەڕێنەرەوە دواوە: F→C، B→Y، E→B، H→E، U→R و هتد. تاکە پیتی سەخت Bـە کە ژمارە 1ـە: کە دەکاتە Y. CYBER SECURITYـە.
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) نیشانەیەکی باشە: وشەی دوو پیتی زۆر نین.
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): خێرایە و تەنها تۆ کلیلەکەت پێویستە، بۆیە کێشەی هاوبەشکردن نییە.
- (ج) بە کۆمپانیاکە؛ مۆبایلەکە بە کۆمپانیاکە دەیپشکنێت.
- (د) بە وەرگرەکە — لە ڕاستیدا بۆ پاراستنی هاوچەشن بەکار دێت کە خودی فایلەکە شفرە دەکات.
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 () shows the idea and its weakness: only 25 keys, so brute force breaks it at once. AES has at least 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.
- بە و کلیلێک دەگۆڕێت بۆ ؛ پێچەوانەکەی دەکات. ئاشکرایە؛ کلیلەکە نهێنییەکەیە.
- () بیرۆکەکە و لاوازییەکەی پیشان دەدات: تەنها 25 کلیل، بۆیە یەکسەر دەیشکێنێت. AES لانیکەم کلیلی هەیە.
- هاوچەشن: یەک کلیلی هاوبەش، خێرا (AES)، بەڵام کلیلەکە دەبێت هاوبەش بکرێت. ناهاوچەشن: جووتێک کلیل ( و )، خاوتر (RSA، چەماوەی ئێلیپتیکی)، کێشەی هاوبەشکردنی کلیل چارەسەر دەکات. سیستەمە ڕاستەقینەکان تێکەڵیان دەکەن.
- پەنجەمۆرێکی یەک ئاراستە بە درێژیی جێگیر دەدات؛ گۆڕانی بچووک نرخێکی بە تەواوی جیاواز دەدات. بە و هاشێکی خاو هەڵدەگیرێن.
- ( واژوو دەکات، دەیپشکنێت) ، و دەدات، نەک . کە CA واژوویان دەکات بە دەبەستنەوە؛ TLS هەموو ئەمانە بەکار دەهێنێت.
- لە گواستنەوەدا (TLS، )، لە دۆخی وەستاودا ( دیسک و ) و بۆ نامەکان بە شێوەی سەرتاسەری بپارێزە.
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.ڤیدیۆیەک کە بینەران زۆریان پێ خۆش بووە و لە کۆمێنتەکانیاندا ستایشیان کردووە، بۆ ئەم وانەیە هەڵبژێردراوە.
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زاراوە سەرەکییەکان
Where Vulnerabilities Come Fromخاڵە لاوازەکان لە کوێوە دێن
Related lecturesوانە پەیوەندیدارەکان
- Passwords, MFA and Access Controlتێپەڕەوشەکان، MFA و کۆنترۆڵی دەستڕاگەیشتن
- Security by Obscurity, by Legislation, and the Trade-off Triangleئاسایش بە شاردنەوە، ئاسایش بە یاسا و سێگۆشەی هاوسەنگی
- Threats, Vulnerabilities, Attacks and Riskهەڕەشەکان، خاڵە لاوازەکان، هێرشەکان و مەترسی
- Database Security: Threats and Countermeasuresئاسایشی بنکەدراوە: هەڕەشەکان و ڕێوشوێنەکانی بەرگری
- RAID, Web Security and Data ProtectionRAID، ئاسایشی وێب و پاراستنی دراوە
- Securing Data in PHP and MySQLپاراستنی دراوە لە PHP و MySQL
- The Internet and the Webئینتەرنێت و وێب
- Ransomware: WannaCry, NotPetya and Recent Attacksنەرمەواڵەی بارمتەگر: WannaCry، NotPetya و هێرشە نوێیەکان
References and further readingسەرچاوەکان و خوێندنەوەی زیاتر
- NIST CSRC Glossary: encryption
- NIST CSRC Glossary: hash function
- NIST CSRC Glossary: digital signature
- NIST FIPS 197: Advanced Encryption Standard (AES), 2001, updated 2023
- NIST: NIST Releases First 3 Finalized Post-Quantum Encryption Standards (13 August 2024)
- NIST SP 800-63B-4: Digital Identity Guidelines — Authentication and Authenticator Management (password verifiers, salting)
- OWASP Password Storage Cheat Sheet
- Harvard CS50 Introduction to Cybersecurity, Lecture 1: Securing Data (notes)
- Yale CPSC 467 Cryptography and Security, Lecture 4: Symmetric cryptography and the Caesar cipher (M. J. Fischer, 2020)
- MDN Web Docs: Transport Layer Security (TLS)
- MDN Web Docs Glossary: TLS
- Python documentation: hashlib — Secure hashes and message digests
- NIST: NIST Selects HQC as Fifth Algorithm for Post-Quantum Encryption (11 March 2025)
- NIST CSRC: Post-Quantum Cryptography project (standards and transition timeline)
- CA/Browser Forum: Ballot SC-081v3 — Introduce schedule of reducing validity and data reuse periods (April 2025)
- DNSimple: SSL certificate validity changes 2026–2029 (200 days from 15 March 2026)
This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.