Adding a shared library for common classes
This commit is contained in:
25
aurora-shared/Utils/HashUtil.cs
Normal file
25
aurora-shared/Utils/HashUtil.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System;
|
||||
|
||||
namespace Aurora.Utils
|
||||
{
|
||||
public class HashUtil
|
||||
{
|
||||
public static Guid GetHash(string[] inputs)
|
||||
{
|
||||
string input = "";
|
||||
foreach (string str in inputs)
|
||||
{
|
||||
input += str;
|
||||
}
|
||||
|
||||
byte[] stringbytes = Encoding.UTF8.GetBytes(input);
|
||||
byte[] hashedBytes = new System.Security.Cryptography
|
||||
.SHA1CryptoServiceProvider()
|
||||
.ComputeHash(stringbytes);
|
||||
Array.Resize(ref hashedBytes, 16);
|
||||
return new Guid(hashedBytes);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user