Notes and Requirements for HMAC-SHA-1 Implementation

  1. You are assumed to use Java. Before submitting your programs, make sure they can make and run. 
  2. Submit 2 files
  3. Your program should take two arguments: a password and an input file name. For example, you may use the following command to compute an HMAC for the file "mytarball.tgz", using the password hmac123456.

java HMACSHA1 hmac123456 mytarball.tgz

Use "UTF8" encoding for the password. This means that you can use, for example, PasswordString.getBytes ("UTF-8") to get the byte value of the password.

Implement HMAC using SHA-1 as the building block. That is, assume SHA-1 algorithm is given, and you should implement the HMAC computation using SHA-1. Also use SHA-1 to hash your input password to get the key used in the HMAC algorithm.


Assume the input message is stored in the file with the given name. After computing the HMAC, convert the result into hexdecimal and print it on the screen. Use all upper case letters for hexdecimal 'A' through 'F'.
  1. You should test your program before submission. At least make sure you can get the plaintext back. Also check with TA's test vectors.
  2. Grading. If your program can run, you get 5 basic points. Your program will be tested again 5 random files generated by the TA. You will get 3 points for the correct execution of each of them.
  3. Submission: You need to submit your 2 files online through the blackboard.

Test Vectors:

Download test vectors.

Please direct all questions about the text vectors to the TA.