MessageDigest hashes differently on different machines?

Encodings are causing you problems. First here.

Encodings are causing you problems. First here: saltPlusPlainTextPassword.getBytes() That will use the default encoding for the machine. Bad idea.

Specify "UTF-8" as a simple solution. (It's guaranteed to be present. ) Next this causes issues: String hashed = new String(hashedByteArray); hashedByteArray is arbitrary binary data.To safely convert it to text, either use a base-64 encoding or just hex.

Again, you're currently using the default encoding, which will vary from machine to machine. There are loads of 3rd party libraries for base64 encoding in Java.

Likely Jon Skeet's solution above is the cause, and his recommendations should definitely be taken into account, but another possible cause is a misunderstanding of salt. Salt is a semi-secret random value that is applied to a String prior to hashing. This makes it harder to perform a brute force attack when trying to guess what an originating String was because the salt is presumably unknown to the attacker.

Salt values generally differ installation to installation. Its possible that the actual cause is just that you have the salt values set differently on the different machines.

Cool, I added the code I'm using to generate the salts above. Thanks for your response, I'll upvote in a few hours when it lets me again. – DutrowLLC Jun 19 '10 at 21:51 @DutrowLLC: Given that you're already using commons codec, that's how you should base-64 encode the hash.

– Jon Skeet Jun 19 '10 at 22:20.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions