MessageDigest.update
843811Feb 7 2010 — edited Feb 8 2010Hello,
I'm currently writing an iPhone app which connects and authenticates with a server written in Java. Due to security, I want to send the user data encrypted.
On the server I use:
byte[] bSalt = base64ToByte(salt);
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.reset();
digest.update(bSalt);
byte[] bToHash = digest.digest(toHash.getBytes("UTF-8"));
for (int i = 0; i < 3; i++) {
System.out.println(byteToBase64(bToHash));
digest.reset();
digest.update(bSalt); // More secure?
bToHash = digest.digest(bToHash);
}
By now, I managed to hash in Objective C, too, but the salt is the problem. For getting the same hashing results in ObjC, I need to know what MessageDigest.update does. Does it simply compute an OR with the current digest and the salt or what does it do? Thanks for your help.
Greetings
Naznaz