prayreadgame
0
Q:

BCrypt c#

// Como criar uma chave para uma string criptografada

using BCrypt.Net;

public class Hashing  
{
    private static string GetRandomSalt()
    {
        return BCrypt.GenerateSalt(12);
    }

    public static string HashPassword(string password)
    {
        return BCrypt.HashPassword(password, GetRandomSalt());
    }

    public static bool ValidatePassword(string password, string correctHash)
    {
        return BCrypt.Verify(password, correctHash);
    }
}
0

New to Communities?

Join the community