I've been trying to figure out how to get an MD5 Hash of a UTF16-LE encoded string in JavaScript for the past few days. I have a method in C# as an example, but I'm not sure how to replicate it in JavaScript.
Example:
public string GetMD5Hash (string input) {
MD5 md5Hasher = MD5.Create();
byte[] data = md5Hasher.ComputeHash(Encoding.Unicode.GetBytes(input));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.Length; i++) {
sb.Append(data[i].ToString("x2"));
}
return sb.ToString();
}
Desired Output:
var getMD5Hash(input){
....
}
var t = getMD5Hash("1234567z-äbc");
console.log(t) // --> 9e224a41eeefa284df7bb0f26c2913e2
Any help would be greatly appreciated :-/