-
Notifications
You must be signed in to change notification settings - Fork 0
/
FastHash.cs
32 lines (28 loc) · 837 Bytes
/
FastHash.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using DeviceId;
using System.Text;
namespace D4ServerRate
{
class FastHash
{
public static string CalculateUUID()
{
string uuid = new DeviceIdBuilder()
.AddMachineName()
.AddMacAddress()
.AddOsVersion()
.OnWindows(windows => windows
.AddProcessorId()
.AddMotherboardSerialNumber()
.AddSystemDriveSerialNumber())
.AddUserName()
.ToString();
byte[] inputBytes = Encoding.UTF8.GetBytes(uuid);
uint hash = 2166136261;
for (int i = 0; i < inputBytes.Length; i++)
{
hash = (hash * 16777619) ^ inputBytes[i];
}
return hash.ToString("X8");
}
}
}