-
-
Save feanz/6516510 to your computer and use it in GitHub Desktop.
Guid Hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Guid Hash(params object[] args) | |
{ | |
var composite = ""; | |
foreach (var a in args) | |
{ | |
composite += a.ToString(); | |
} | |
Guid result; | |
using(var md5 = new MD5CryptoServiceProvider()) | |
{ | |
var bytes = System.Text.Encoding.UTF8.GetBytes(composite); | |
result = new Guid(md5.ComputeHash(bytes)); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment