本文介绍了.Net Core替代System.Web.Helpers.Crypto库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前有一个现有项目,该项目使用Crypto库对密码进行哈希处理:

We currently have an existing project which uses to the Crypto library to hash passwords:

我们正在寻求转移到.net核心.   .net核心中是否有等效替代品,这样我们就不必重新哈希所有现有密码了?

We are looking to move over to .net core.  Is there an equivalent replacement in .net core so that we do not have to re-hash all our existing passwords?

推荐答案

>>我们正在寻求转移到.net核心.   .net核心中是否有等效的替代品,这样我们就不必重新哈希所有现有密码了?

根据您的描述,我创建了一个简单的asp.net核心应用程序,并尝试将块包添加到项目中.但该软件包与netcoreapp1.0和netcoreapp1.1不兼容,我建议您可以等待软件包升级 支持.Net Core.

According to your description, I create a simple asp.net core app and try to add the nugget package to project. but the package is not compatible with netcoreapp1.0 and netcoreapp1.1,  I would suggest that you could wait for the package upgrade to support .Net Core.

您还可以编写自定义方法来哈希相关的密码.像这样:

You could also write custom method to hash related password. like this:

public static string HashPassword(string pass)
        {
            // generate a 128-bit salt using a secure PRNG
            byte[] salt = new byte[128 / 8];
            using (var rng = RandomNumberGenerator.Create())
            {
                rng.GetBytes(salt);
            }
            Console.WriteLine(


https://docs.microsoft.com /en-us/aspnet/core/security/data-protection/consumer-apis/password-hashing

最诚挚的问候,

吴可乐


这篇关于.Net Core替代System.Web.Helpers.Crypto库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 02:40