For a prototype application, I create a simple user login. The user password will then be hashed using sha224 and passed into the background code. The problem that I am currently facing is the following. The password that was stored in the database (also hashed using sha224) seems a little different from the hash that I am sending. To create hashes, I use the following code.
Password set == test
Python
from hashlib import sha224
sha224("test").hexdigest()
Android
MessageDigest sha224 = MessageDigest.getInstance("SHA-224");
sha224.update(key.getBytes());
byte[] digest = sha224.digest();
StringBuffer buffer = new StringBuffer();
for(int i = 0; i < digest.length; i++) {
buffer.append(String.valueOf(Integer.toHexString(0xFF & digest[i])));
}
return buffer.toString();
What will be created now looks like this, and I will post two hashes right under each other. (The first is python and the second is android)
90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809 90a3ed9e32b2aaf4c61c41eb925426119e1a9dc53d4286ade99a89
They are pretty much the same, but the python hash has two more 0. Do you guys know why?