我的旧项目用于散列密码的格式和算法是什么

What is the format and algorithm that my old project is using for hashing password

普通字符串

Passw0rd

由 MVC 项目散列

4mLjm+Nu1e5MUMsW03dwMw2vm80=

我认为旧项目正在使用MVC4。我正在尝试从 ASP.NET 核心 3.1 散列密码。两个项目指向同一个数据库,所以我想确保 asp.net 核心 3.1 密码哈希器生成与上面的哈希密码相同的密码。

有什么方法可以从 asp.net core3.1 生成这个散列密码吗?验证密码?

默认哈希算法是 HMACSHA256。但是,您需要确认查看您的代码和配置。在这里查看:

https://docs.microsoft.com/en-us/aspnet/whitepapers/aspnet4/breaking-changes#default-hashing-algorithm-is-now-hmacsha256

一旦确认您可以使用 Microsoft.AspNetCore.Cryptography.KeyDerivation 做同样的事情:

https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/consumer-apis/password-hashing?view=aspnetcore-3.1