MediumPro challengeJavaScriptTypeScript
Weak Password Hashing — The Salt Must Affect the Output
JavaScriptSecurityCryptographic Issues
The password-hashing function below is supposed to combine a password with a per-user salt, but the salt is silently ignored.
The bug: without a salt actually mixed into the hash, two users with the same password get the exact same hash — letting an attacker with database access instantly spot duplicate passwords and use precomputed rainbow tables, defeating the entire purpose of salting.
Your task: fix solve(password, salt) so the returned hash genuinely depends on both password and salt — changing either one must change the output.
Sample tests
Test #1Password + salt A
Input: ["hunter2","saltA"]
Output: "ac60ae3"
Test #2Same password, different salt — different hash
Input: ["hunter2","saltB"]
Output: "9f0a79e4"
Test #3Different password, same salt — different hash
Input: ["otherpw","saltA"]
Output: "7b01a348"