From 4dd72017274208d32978979c3803c5c6d9656fe8 Mon Sep 17 00:00:00 2001 From: CroakFang <1605296300@qq.com> Date: Tue, 13 Dec 2022 22:57:59 +0800 Subject: [PATCH] update --- Assets/Scripts/{Test.cs => ManifestEntry.cs} | 17 +++++------------ .../{Test.cs.meta => ManifestEntry.cs.meta} | 0 2 files changed, 5 insertions(+), 12 deletions(-) rename Assets/Scripts/{Test.cs => ManifestEntry.cs} (51%) rename Assets/Scripts/{Test.cs.meta => ManifestEntry.cs.meta} (100%) diff --git a/Assets/Scripts/Test.cs b/Assets/Scripts/ManifestEntry.cs similarity index 51% rename from Assets/Scripts/Test.cs rename to Assets/Scripts/ManifestEntry.cs index 5bc6597..0bef48d 100644 --- a/Assets/Scripts/Test.cs +++ b/Assets/Scripts/ManifestEntry.cs @@ -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); } diff --git a/Assets/Scripts/Test.cs.meta b/Assets/Scripts/ManifestEntry.cs.meta similarity index 100% rename from Assets/Scripts/Test.cs.meta rename to Assets/Scripts/ManifestEntry.cs.meta