Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

MessageDigest.update

843811Feb 7 2010 — edited Feb 8 2010
Hello,
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2010
Added on Feb 7 2010
8 comments
572 views