summaryrefslogtreecommitdiff
path: root/WorldlineKeepers/Assets/Scripts/Utils
diff options
context:
space:
mode:
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: