Cryptography and Coding Systems – Spring Term

 

Practical 1 – Using hash function for password

 

We ask you to implement a program which can handle a users’ login session using SHA-1

 

In more details, the following functions are required.

 

·        When a new user comes to register, it stores a users’ login ID and password. The password must be saved after applying the SHA-1 hash function (provided in Java). In addition to this, you need to make sure the user name has not been used by someone else.

 

·        When someone tries to login, wrong user IDs and wrong passwords must be rejected.

 

In order to help you familiar with the way of using SHA-1, a java program is provided. This program reads an input string, generates the string’s SHA-1 hash code, and then prints it out on screen. By reading this program, you can work out how to use Java’s SHA-1. You can adapt two methods in the code, convertToHex and SHA1, to your program. If you have already used SHA-1 before, you probably don’t need to read this program.

 

Note that you don’t need to use a database for storing users’ information, just use an array or a hash table.