This commit is contained in:
CroakFang
2022-12-13 22:57:59 +08:00
parent df178687ba
commit 4dd7201727
2 changed files with 5 additions and 12 deletions
@@ -6,19 +6,12 @@ using UnityEngine;
namespace Assets.Editor.RootMotion
{
public class Test : MonoBehaviour
public class ManifestEntry
{
private void Start()
{
SHA1CryptoServiceProvider sha = new SHA1CryptoServiceProvider();
var str = CalHameString(sha, 1541716412357448819, 77, Encoding.UTF8.GetBytes("root"));
Debug.LogWarning($"{str} Length:{str.Length}");
Debug.LogWarning($"{"FN4II57IWE274AT5R45G2UE7XVMFDPBD"} Length:{"FN4II57IWE274AT5R45G2UE7XVMFDPBD".Length}");
}
public byte[] CalHame(SHA1CryptoServiceProvider sha1, ulong checksum, ulong size, byte[] name)
public static byte[] CalHame(ulong checksum, ulong size, byte[] name)
{
if (name == null) return null;
SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider();
byte[] allbyte = new byte[name.Length + 16];
byte[] checksumByte = BitConverter.GetBytes(checksum);
byte[] sizeByte = BitConverter.GetBytes(size);
@@ -30,9 +23,9 @@ namespace Assets.Editor.RootMotion
return sha1.ComputeHash(allbyte);
}
public string CalHameString(SHA1CryptoServiceProvider sha1, ulong checksum, ulong size, byte[] name)
public static string CalHameString(ulong checksum, ulong size, byte[] name)
{
var bytes = CalHame(sha1, checksum, size, name);
var bytes = CalHame(checksum, size, name);
Base32 base32 = new Base32();
return base32.Encode(bytes);
}