obfuz/Editor/Utils/HashUtil.cs

29 lines
675 B
C#
Raw Normal View History

2025-04-28 11:37:48 +08:00
using dnlib.DotNet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2025-05-04 19:24:14 +08:00
namespace Obfuz.Utils
2025-04-28 11:37:48 +08:00
{
public static class HashUtil
{
public static int CombineHash(int hash1, int hash2)
{
return hash1 * 1566083941 + hash2;
}
public static int ComputeHash(List<TypeSig> sigs)
{
int hash = 135781321;
TypeEqualityComparer tc = TypeEqualityComparer.Instance;
foreach (var sig in sigs)
{
hash = hash * 1566083941 + tc.GetHashCode(sig);
}
return hash;
}
}
}