I'm struggling with difference in MD5 result consumption in Kotlin (Java) and C#. I've found this article thats suggests solution:
How can you generate the same MD5 Hashcode in C# and Java?
But I would like to understand logic behind this. I've done couple of tests. C#:
var data = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes("123456"));
var s = Encoding.UTF8.GetString(data, 0, data.Length);
Produces following byte sequence (data variable):
225, 10, 220, 57, 73, 186, 89, 171, 190, 86, 224, 87, 242, 15, 136, 62
If I use Kotlin (Java):
val md = MessageDigest.getInstance("MD5")
val data = md.digest("123456".toByteArray())
val s = String(data)
val ls2 = data.map { x-> x.toUByte() }
So Java has bytes with sign, and c# unsigned (ls2 - contains same unsigned bytes as c# example). Fine. I would like to get string value - I convert both byte arrays to string and I got different strings (s variable). What do I miss?
Thanks.