Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Convert string to it's GUID equivalent.
- /// </summary>
- /// <param name="value">The value.</param>
- /// <returns></returns>
- private static Guid ToGuid(this string value)
- {
- // Create a new instance of the MD5CryptoServiceProvider object.
- MD5 md5Hasher = MD5.Create();
- // Convert the input string to a byte array and compute the hash.
- byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(value));
- return new Guid(data);
- }
Advertisement
Add Comment
Please, Sign In to add comment