Calculating md5
Bash (Linux Command Line)
$ echo -e "string to hash" | md5sum
2fcc83d76f9b2d8ef372271d807a3364 -$ echo -e " string to hash " | md5sum
6b9202a3b05bd22803fe54767b30ee10 -$ echo -e -n "" | md5sum
d41d8cd98f00b204e9800998ecf8427e -C\
static private string GetMd5Hash(string input) {
MD5 md5Hash = MD5.Create();
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
return ByteToString(data);
}
// Helper function to convert a byte array to a string.
static private string ByteToString(byte[] data) {
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++) {
sBuilder.Append(data[i].ToString("x2"));
}
return sBuilder.ToString();
}Java
Javascript
Nodejs
Objective-C
PHP
Last updated