summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Scripts/Utils
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-05-16 08:50:55 +0800
committerchai <215380520@qq.com>2023-05-16 08:50:55 +0800
commit27df4282109a26a21aa042793c3136fbb5b81a98 (patch)
treefb20d2b3b6270430eaa32de9a0c88aa7ea5d8258 /WorldlineKeepers/Assets/Scripts/Utils
parent85629d871b1cbf65e57c8e25b2145c0b77f7e353 (diff)
*misc
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/Utils')
-rw-r--r--WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs30
-rw-r--r--WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs.meta11
2 files changed, 41 insertions, 0 deletions
diff --git a/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs b/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs
new file mode 100644
index 0000000..b9ec52e
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs
@@ -0,0 +1,30 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Security.Cryptography;
+using System.Text;
+using UnityEngine;
+
+namespace WK.Utils
+{
+
+ public class StringUtils
+ {
+
+ public static byte[] GetHash(string inputString)
+ {
+ using (HashAlgorithm algorithm = SHA256.Create())
+ return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString));
+ }
+
+ public static string GetHashString(string inputString)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (byte b in GetHash(inputString))
+ sb.Append(b.ToString("X2"));
+
+ return sb.ToString();
+ }
+
+ }
+
+}
diff --git a/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs.meta b/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs.meta
new file mode 100644
index 0000000..555da6c
--- /dev/null
+++ b/WorldlineKeepers/Assets/Scripts/Utils/StringUtils.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 917c8c50054333a45b8925c7b33ffdf5
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: