ASCI Logo
ASCI.Academy
LearnPracticeCompeteCareer
Sign InGet Started

Search ASCI Academy

Universal search across Courses, Lessons, Skills, Projects, Challenges, Competitions, Jobs, Internships, and Users

cs50 cybersecurity

Curriculum Index

Current LevelInitiate
0/ 500 XP
Gravit Certificate:
100% Required
  • 1.1 Encoding vs Hashing vs Encryption
  • 1.2 Salted Hashes & Rainbow Table Defense
•
1
2
3
4
5
6
7
8
9
10
Module 1: Securing Accounts — Authentication & Hashing•Lesson 2

1.2 Salted Hashes & Rainbow Table Defense

### Defeating Rainbow Tables
If two users choose the same password ('hunter2'), their unsalted SHA-256 hashes will be identical. An attacker with a precomputed lookup table (rainbow table) can crack millions of passwords instantly.

**Salting** appends a unique random string (the salt) to each password before hashing:
$$H(\text{password} + \text{salt})$$
Even identical passwords produce completely different hash strings!
Python 3.11
•
Interactive Challenge
+75 XP
Challenge Objective

Combine the salt and password and print 'SALTED_LENGTH:15'.

solution.py
UTF-84 SpacesAuto-saved
cpython3.11:~/workspace
CPython 3.11.8 (WASM)
$python3 -u solution.py
Click "Compile & Run" (or press Ctrl + Enter) to compile AST, verify bytecode, and execute the solution.