Hashing for Security: Securing Passwords
Introduction to Password Storage
This video introduces the concepts you will learn in this Unit.
One-Way FunctionsBefore we can discuss how hashing is used to secure passwords, we must first understand the concept of a one-way function in math/computer science. Consider a function such as:
f(x) = x2
This function is a two-way function. Given the input, say 3, we can easily calculate the output as 9. Likewise, given the output of 9, we can calculate that the input must have been 3 or -3. Now consider the following function:
f(x) = x % 13
This is a one-way function. Once again, given the input of 3, we can easily calculate the output of 3. But now, given the output of 3, we cannot easily calculate the input because there are an infinite number of possibilities. One-way (and related trapdoor) functions are an important tool in modern cryptography.
Using Hashing to Secure PasswordsIf we pick a one-way function as our hashing function, we can track and verify our users' passwords without actually storing them (which would be an unnecessary security risk). This video explains how:
Importance of Adding Salt to a Password File
Using Pepper to Slow Down a Hacker
Which of the following is a one-way function?