feat: networking type hasher added

This commit is contained in:
Syntriax 2025-08-19 21:17:47 +03:00
parent f5a7077570
commit 8e314f3269

View File

@ -0,0 +1,27 @@
namespace Engine.Systems.Network;
public static class TypeHasher<T>
{
private static long _fnv1a = 0;
public static long FNV1a
{
get
{
if (_fnv1a == 0)
unchecked
{
const long fnvPrime = 1099511628211;
_fnv1a = 1469598103934665603;
string typeName = typeof(T).FullName ?? typeof(T).Name;
foreach (char c in typeName)
{
_fnv1a ^= c;
_fnv1a *= fnvPrime;
}
}
return _fnv1a;
}
}
}