Different uses of hashing
π§ PART 1 β WHAT IS HASHING? (FROM ZERO)
π‘ Start with a problem
Imagine you store a password:
mypassword123If someone hacks the system:
π They can see the password π¬
π Solution: Hashing
Instead of storing the password, we store a hash
π‘ What is a hash?
π A hash is the output of a function that turns data into a fixed-length string.
Example:
mypassword123 β 9f86d081884c7d65π That output = hash value
β Important properties (YOU MUST KNOW)
One-way
You cannot reverse it easily
You canβt get the original data back
Same input β same output
Always consistent
Small change β completely different hash
Example:
password β 5f4dcc3b5aa
Password β 7c6a180b368π₯ KEY IDEA
π Hashing is NOT encryption
π You cannot decrypt a hash
π§ PART 2 β USES OF HASHING (WHAT OCR CARES ABOUT)
π΅ 1. Password Storage
π‘ How it works
User creates password
System hashes it
Hash is stored (NOT the password)
π Login process
User enters password
System hashes it again
Compares hashes
β If same β access granted
β If different β denied
π Why this is good
Even if hacked:
π attacker only sees hashes, not passwords
π΄ 2. Data Integrity (Checking data hasnβt changed)
π‘ Problem
You download a file β how do you know it wasnβt changed?
π‘ Solution
Original file has a hash
You download file
Your computer hashes it
Compare hashes
β Same β file is safe
β Different β file has been altered
π’ 3. Digital Signatures (simplified)
Used to verify:
sender identity
data integrity
π Instead of signing the whole file:
hash is created
hash is signed
Faster and efficient
β ADVANTAGES & DISADVANTAGES
β Advantages of Hashing
Protects passwords (not stored directly)
Fast to compute
Ensures data integrity
Fixed output size (efficient)
One-way (secure)
β Disadvantages of Hashing
Cannot retrieve original data
Vulnerable to brute force attacks (guessing inputs)
Possible collisions (two inputs give same hash β rare but possible)
Needs extra security (e.g. salting β not required in depth for OCR)