I am trying to get the md5 hash of a char array. Below is my code.
data = unicode2native(data, 'UTF-8');
K = java.security.MessageDigest.getInstance('MD5');
md5 = reshape(dec2hex(typecast(K.digest(data), 'UINT8')), 1, 32);
Wikipedia lists some example hash values for strings. For example, the input of "The quick brown fox jumps over the lazy dog" should yield a md5 hash of 9e107d9d372bb6826bd81d3542a419d6, however my implementation gives the following 917932b86d134a1de0dd7b62b8d52496 which obviously does not match.
I am not quite sure where the problem may be but perhaps it has to do with the char conversion on the first line.