22 lines
637 B
C#
22 lines
637 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FirebaseKaraoke.Extensions
|
|
{
|
|
public static class StringExtension
|
|
{
|
|
public static Guid ToGUID(this string input)
|
|
{
|
|
// 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(input));
|
|
return new Guid(data);
|
|
}
|
|
}
|
|
}
|