using System.Security.Cryptography; using System.Text; namespace Plugin.SNGenerateTool { internal class HashPlus { public static string GetHashSHA256(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (SHA256Managed sHA256Managed = new SHA256Managed()) { byte[] array = sHA256Managed.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } public static string GetHashSHA512(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (SHA512Managed sHA512Managed = new SHA512Managed()) { byte[] array = sHA512Managed.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } public static string GetHashSHA384(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (SHA384Managed sHA384Managed = new SHA384Managed()) { byte[] array = sHA384Managed.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } public static string GetHashSHA1(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (SHA1Managed sHA1Managed = new SHA1Managed()) { byte[] array = sHA1Managed.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } public static string GetHashMD5(string text) { byte[] bytes = Encoding.Unicode.GetBytes(text); using (MD5 mD = MD5.Create()) { byte[] array = mD.ComputeHash(bytes); string text2 = string.Empty; byte[] array2 = array; foreach (byte b in array2) { text2 += $"{b:x2}"; } return text2; } } } }