The SHA256 stuff is working fine, but I can't convert the MD5 hash result from a word array back into a string. Below is the code I'm using to just degug the problem - I've subbed out the actual hash results, and added the
email_hash = $rootScope.session.email.toLowerCase();
// email firstname.lastname@example.org
sha_hash = CryptoJS.SHA256(email_hash).toString(CryptoJS.enc.Hex);
// sha SHA256-VALUE-OUTPUTS-FINE
email_hash = CryptoJS.MD5( email_hash );
console.log( JSON.stringify( email_hash ) );
a = email_hash.toString( CryptoJS.enc.Latin1 );
b = email_hash.toString( CryptoJS.enc.Hex );
console.log( a, b );
// [object Object] [object Object]
Oh ok - the answer is not in the code I posted.
I was using version 3.0.2 of the SHA256 code, and version 3.1.2 for MD5.
Updating SHA256 to 3.1.2, so they are both on the same version, has fixed it. I'm including the SHA256 before the MD5, so it must have been overwriting something in the MD5 file.