For protecting passwords, hash value of that password is stored in database. I am using this code for generating hash value of a string: http://www.exampledepot.com/egs/javax.crypto/GenMac.html
But i found that it generates random hash for the same string each time. So i am not able to use it for password validation.
How to make that code generate hash value based on the String only ? That is, if i input "iloveyou" it should generate the same hash value each and every time. Not a different one.