CSSE/MA479: Cryptography
Homework 8, due on the date listed on the schedule page
- Work on your term project
- (80 pts) SHA-1 Implementation. Implement and test the SHA-1 algorithm.
- Input: a file called sha_input.txt that contains a message all on a
single line. The
message will be composed of ASCII characters and terminated by a
newline. The newline is not considered part of the message to be
hashed. You may not assume that the message is a specific
length (except that it will be less than 2^32 bits), but you may assume that the length of the input string is a multiple of 8 bits.
An implementation that works only for small messages
will have a correspondingly small grade assigned.
- Output: a 160-bit digest, expressed in
hexadecimal (length 40). Pad with leading zeros if necessary to
output the full 160 bits.
- Grading: totally on correctness
and style. You will earn full points for efficiency
unless you can't manage to pull off the 80
iterations in 5 seconds (you'd have to purpose to
write inefficient code to make that happen, I
think).
- Round keys: 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6
- H0-H4: 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
- Debugging: the tool at
http://people.eku.edu/styere/Encrypt/JS-SHA1.html
gives answers and intermediate output.
- Note that the book has an error in its
implementation: The addition of [a b c d e] to x
should happen only once after iteration 80 (so at
the end of h').