我从这里 Bcrypt.Net 下载了bcrypt.net。要添加 dll 文件,请右键单击项目名称,然后选择“ References... ”。将打开一个窗口,然后浏览要插入的 dll 文件。然后根据需要在 C# 页面中添加代码。
using BCrypt;
public partial class your_class_name : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string salt = BCrypt.Net.BCrypt.GenerateSalt(); //Generate Salt
string hash = BCrypt.Net.BCrypt.HashPassword("subinoy", salt); //Using salt to generate password
if(BCrypt.Net.BCrypt.Verify("username","$2a$10$ljfI1o3m3gI.rXDpDkGc/ebUNqHKJ22EhJrQJnuoe3yAf58QoZW6i")) //this hash inside the if() will be taken from the database when the user registered
bcrypttext.Text = "equals";
else
bcrypttext.Text = "Not equal" + hash;
}
}
对于php bcrypt你看这个链接