unsigned long
hash(unsigned char *str)
{
unsigned long hash = 5381;
int c;
while (c = *str++)
{
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
}
return hash;
}
11 Jun 2024
In this assignment, you’ll play with ciphers and passwords.
All students should complete parts 1 and 2 of this assignment. ENGI 9823 students should also complete part 3. Submit your work — in a single PDF file — to Gradescope.
Part 1: Host security
-
On a computer with Unix permissions, identify eight files with different combinations of
owner
,group
andpermissions
. Explain the meaning of each file’s permissions. -
Suppose that a popular website suffers a breach of their user password database. What could we infer about the password database from each of the following?
-
An attacker is able to immediately access every user’s password.
-
An attacker is able, with the addition of a leaked key, to access any user’s password.
-
An attacker is able to tell that 4,000 users have the same password.
-
An attacker is able to crack the stolen passwords in milliseconds per guess.
-
-
Compute the Shannon entropy of the following distributions.
-
$ \left\{ \frac{1}{8}, \frac{1}{2}, \frac{1}{16}, \frac{1}{4}, \frac{1}{16} \right\} $
-
Passwords drawn from a Diceware list of $6^5$ passwords
-
Passwords with one of the Diceware words from above followed by one of 16 special characters
-
Passwords with four of the Diceware words from above
-
Part 2: Symmetric-key cryptography
-
Consider a trivial "block cipher" that simply multiplies its 8b input by an 8b key mod 256, i.e.:
\[ C = k \cdot P \mod 256 \]
-
Given the following implementation of the
djb2
hash algorithm:-
Write a program (in a language of your choice) that will search for collisions.
-
Run your program. How many input strings did you need to check before you found a collision?
-
Is this hash function suitable for use as a cryptographic hash function? Explain why or why not.
-
Part 3: Password entropy (ENGI 9823 only)
-
Using the this table of symbol frequencies[1], write a program in a language of your choice to calculate the following quantities. Submit your answers to the questions as well as a listing of your code in your submission PDF. Your code must calculate, for the provided input file:
-
the total number of times that each symbol was observed by Jones and Mewhord in their data collection
-
the relative frequency of each character as a percentage of the total characters
-
-
Calculate the Shannon entropy of the password distributions that could have produced the following passwords via random selection. State all assumptions that go into your calculations.
-
secure
-
secure1
-
secure!6@
-
s3cur31ty
-
y9]z'626:g
-