Imagine you have a list of passwords hashed without any extra data. What is the main reason to add a salt to each password before hashing?
Think about what happens if two users choose the same password.
Adding a salt ensures that even if two users have the same password, their hashes look different. This prevents attackers from using precomputed tables to crack passwords.
Follow the steps in this flowchart for a login process using password and a one-time code sent to a phone. What is the output if the password is correct but the code is wrong?
Start -> Enter username and password -> Check password -> If correct, send code -> Enter code -> Check code -> If correct, login success; else, login fail
Both password and code must be correct to succeed.
Multi-factor authentication requires all factors to be correct. If the code is wrong, login fails even if the password is right.
Which of the following password policies is the weakest in protecting user accounts?
Think about length and complexity requirements.
Short passwords with only letters are easier to guess or crack. Longer and complex passwords improve security.
Which authentication method provides the strongest protection against stolen passwords?
Consider the security of the second factor.
Hardware tokens are harder to intercept or steal compared to SMS codes, which can be intercepted or SIM-swapped.
Given this simplified Python code for verifying a password, what will be the output if the user enters 'password123' but the stored hash was created with 'Password123' (note the capital P)?
import hashlib def hash_password(pw): return hashlib.sha256(pw.encode()).hexdigest() stored_hash = hash_password('Password123') user_input = 'password123' if hash_password(user_input) == stored_hash: print('Access granted') else: print('Access denied')
Hashing is case sensitive. Check if 'Password123' and 'password123' produce the same hash.
The hash of 'Password123' is different from 'password123' because hashing is case sensitive. So the comparison fails and access is denied.
