Setup and forms
This commit is contained in:
1 parent
aed55f44f9
commit
eee7548fc8
47 files changed
+2837
-8138
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user