first commit

This commit is contained in:
redtea committed 2024-05-23 23:21:24 +03:00
1 parent a9f02f8595
commit 1f6634add4
83 files changed
+28739

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Security;
using System.Text;
using System.Threading.Tasks;
namespace PaymentLogs.Utils
{
internal class StringUtils
{
public static SecureString ConvertToSecureString(string password)
{
if (password == null)
throw new ArgumentNullException("");
var securePassword = new SecureString();
foreach (char c in password)
securePassword.AppendChar(c);
securePassword.MakeReadOnly();
return securePassword;
}
public static String SecureStringToString(SecureString value)
{
return new System.Net.NetworkCredential("qwq112", value).Password;
}
public static string SHA256_hash(string _value)
{
var crypt = new SHA256Managed();
string hash = String.Empty;
byte[] crypto = crypt.ComputeHash(Encoding.UTF8.GetBytes(_value));
foreach (byte theByte in crypto)
{
hash += theByte.ToString("x2");
}
return hash;
}
}
}