Lesson 6 — Intermediate

Cryptography Basics (Symmetric, Asymmetric, Hashing)

Cryptography ka matlab hai data ko isi tarah badalna ki bina sahi key ke padhna mushkil ho. Is lesson mein hum symmetric aur asymmetric encryption, hashing, aur digital signatures samjhenge — HTTPS se UPI tak har secure system inhi par chalta hai.

⏱ 16 min• Intermediate• Network Attacks

Cryptography kya hai

WHAT

Cryptography (secret writing) data ko scrambled format mein badalti hai taaki sirf sahi key wala insaan padh sake. Iska main goal Confidentiality hai, saath hi integrity aur authentication bhi milti hai.

WHEN

HTTPS, WhatsApp messages, UPI, password storage, software updates — jagah jagah crypto chal raha hota hai, dikhata nahi.

WHERE

Banking apps, messaging apps, Wi-Fi (WPA2/WPA3), TLS certificates, digital signatures — har secure channel ke peeche cryptography hai.

Purani history: Caesar cipher (alphabet shift) se lekar aaj ke AES/RSA tak — maqsad same tha, method tez ho gaya. Aaj ka crypto itna strong hai ki supercomputer bhi bina key ke centuries lagayega.

Symmetric vs Asymmetric encryption

SYMMETRIC (shared key)
  Ek hi key encrypt + decrypt dono karti hai
  Fast — large data ke liye ideal
  Algorithms : AES (aaj standard), 3DES, ChaCha20
  Problem    : key doosre ko deni kaise? (exchange mein risk)

ASYMMETRIC (public + private key)
  Public key encrypt karti, private key decrypt (aur ulta)
  Slow — key exchange + signatures ke liye
  Algorithms : RSA, ECC, Diffie-Hellman (key exchange)
  Faida      : private key kabhi share nahi karni padti

REAL WORLD (HTTPS) :
  1. Asymmetric se symmetric key safely exchange
  2. Phir symmetric se poora data (speed chahiye)
  Dono ka mix = practical crypto
Interview gold: Q: "HTTPS mein kya use hota hai?" A: Pehle asymmetric (key exchange + certificate), phir symmetric (bulk data). Sirf asymmetric bolna galat hai — speed wajah se hybrid hota hai.

Hashing — one-way function

Hashing : input -> fixed-size digest (one-way)
  Chhota sa input badlo -> digest pura badal jaata hai
  Reverse karna practically impossible

Algorithms:
  MD5 / SHA-1  : ab broken — sirf checksum ke liye
  SHA-256/SHA-3 : aaj standard (integrity)
  bcrypt/PBKDF2/Argon2 : passwords ke liye specifically

Use cases:
  Passwords : hash + salt karke store (plain text kabhi nahi)
  Integrity : file ka hash compare -> badla toh pata chal jaayega
  Signatures: pehle hash banao, phir sign karo (fast)
  Blockchain: har block ka hash (chain)
Difference yaad rakho: Encryption reversible hai (key se wapas), hashing nahi (one-way). Hash ko "encryption" bolna — sabse common interview mistake hai.

Digital signature aur PKI

Digital signature do cheezein deta hai: Integrity (file badli nahi) aur Non-repudiation (bada mana nahi sakta ki maine sign nahi kiya). Paper signature ka crypto version:

Signature flow (concept):
1. Sender file ka HASH banata hai
2. Hash ko apni PRIVATE key se encrypt = signature
3. File + signature bhejta hai
4. Receiver PUBLIC key se signature khol ke hash nikaalta hai
5. File se apna hash banake compare
6. Match = file intact + sender verify

PKI (Public Key Infrastructure):
  CA (Certificate Authority) -> public key ko identity se jodta hai
  SSL/TLS certificate -> browser ko guarantee ki site wahi hai
  Chain of trust : root CA -> intermediate -> website

Exercise

Question: Symmetric encryption mein kitni key hoti hai — ek ya do? (ek/do)

Question: RSA kis type ka algorithm hai? (symmetric/asymmetric)

Question: Passwords store karne ke liye encryption nahi, kya use hota hai? (hashing/compression)

Common mistakes

Desi example: Company joining pe DSC

TCS/Infosys joining papers mein Digital Signature Certificate (DSC) lagta hai. Wo asymmetric crypto ka live example hai — private key sirf tumhare smart card pe, public key verification ke liye sabke paas:

text
Signing  : document hash + tumhari private key = signature
Verify   : public key + hash se check = sahi hai
Ek line  : private = tumhara pen, public = sabko pen pehchante hain
Ye hi principle HTTPS, Aadhaar signing aur apps mein chalta hai
Exam mapping (TCS / CUET / Security+)
  • TCS NQT: symmetric vs asymmetric — classic 1Q (key count + speed).
  • CUET: hashing vs encryption difference.
  • Security+ : digital signature + PKI concepts detail mein.
  • Trap: "Hashing is reversible with key" — galat, hashing one-way hai.
Lesson complete?

Crypto ke teeno pillars clear. Agla lesson — Network Security — mein dekhenge firewall, IDS/IPS aur VPN kaise kaam karte hain.

Popular courses: Data Science Course in Lucknow · AI Course in Lucknow · Python Course in Lucknow · Power BI Course · Data Analytics Course