CSharp · Console
using System;
using System.Security.Cryptography;
using System.Text;
namespace hasher
{
public class Program
{
public static void Main()
{
Console.WriteLine(CreatePasswordHash("hashcat"));
}
public static string CreatePasswordHash(string pw, string salt)
{
string str = HashPassword(pw, salt);
return "1;" + salt + ";" + str;
}
public static string CreatePasswordHash(string pw) => CreatePasswordHash(pw, "3tKJrhwSwvp1TG0w");
public static string HashPassword(string pw, string salt)
{
Console.WriteLine("HashPassword with pw:" + pw + " salt:" + salt);
using (HashAlgorithm hA = (HashAlgorithm)new SHA256Cng())
return Convert.ToBase64String(hA.ComputeHash(Encoding.Unicode.GetBytes(salt + ";" + pw)));
}
}
}