CS 231: Computer Security

Playing with passwords

Partner or alone, as you wish.

Hand in by creating a folder named "passwords" at the top level of your CS231 repository. See the What to hand in section below for more details.

Part 1. Unsalted passwords

Password files on Unix systems have lines that look something like this:

jondich:2fe7cec3131fa9662906ecfb2eac8a49::0:99999:7:::
This colon-delimited set of fields includes the user name, the MD5 hash of the user's password, and then miscellaneous other stuff that won't concern us.

As we'll see, this is not an ideal format for a variety of reasons, including the fact that MD5 has been substantially weakened by mathematical research and faster computers, but it's certainly an improvement on storing the passwords themselves.

Consider this example password file. Your job for Part 1 is to:

A little help

Part 2. Salted passwords

Now, let's switch to a slightly different password file format:

jondich:e75fa822$8a604057b98aff07885d29eea97e885e::0:99999:7:::

In the hash field, we have an 8-digit hexadecimal number known as "salt", then a dollar sign, and then the hash of the salt (which is just a string of hexadecimal digits) concatenated with the password. As before, the "jondich" password is "moose", so you can use that to check your hash computation code. Also, as before, the hash function we're using is MD5.

(WARNING: This hashing technique is designed to introduce you to the basic idea of salted passwords. However, the technique and salt sizes used here are not ready for prime-time. There are a couple more steps we need to take—longer salts, multiple rounds of hashing, etc.—before we're getting close to best practice for password storage.)

Here's the salted password file. Same kind of passwords as in Part 1.

Again:

By what factor has your password-checking slowed down? Why?

What to hand in?

In your "passwords" folder, put:

Have fun!