在 .net 核心中找不到 RIPEMD160
Cannot find RIPEMD160 in .net core
我在 .net core 3.1 中找不到 RIPEMD160 的任何实现。
网络标准、Core 3.1不存在MS documentation for RIPEMD160 , 核心 5.0 .
在System.Security.Cryptography中找不到相关内容
在寻找第三方包之前(也许Chilkat)我想尝试使用框架库。
Microsoft 决定删除 .NET Core 中哈希和加密算法的“托管”(完全在 .NET 中实现)实现(不要问我为什么)。参见示例 https://github.com/dotnet/runtime/issues/2094(正好是关于 RIPEMD160):
RIPEMD160 is not an algorithm that is provided by the OS crypto layers, and .NET Core no longer carries managed implementations of cryptographic algorithms.
来自msdn:
All hash algorithm and hash-based message authentication (HMAC) classes, including the *Managed classes, defer to the OS libraries. While the various OS libraries differ in performance, they should be compatible.
我找不到是否有关于此的讨论,或者是否有某些经理决定最好以这种方式做或其他什么。
一个简单的解决方案是抓取 .NET 4.7/.NET 4.8 中使用的代码并直接使用:
代码源自 MIT,因此不存在许可问题,请参阅 homepage:
The files in this repository are licensed under the MIT license unless otherwise specified in the file header. If the file header only contains a copyright header (e.g., "Copyright (c) Microsoft Corporation. All rights reserved.", you can assume the associated file to be MIT-licensed.
我开始从 System.Security.Cryptography 复制一些 类 但是因为有很多属性和对其他 classes/interfaces 的依赖我不喜欢那个解决方案。
因为 Chilkat 看起来有点旧(netstandard 1.3)并且在项目中我已经在使用 BouncyCastle 所以最后我只写了这个:
type RIPEMD160 () =
static member ComputeHash (bytes: byte array) =
let hasher = Org.BouncyCastle.Crypto.Digests.RipeMD160Digest()
hasher.BlockUpdate(bytes, 0, bytes.Length)
let hash:byte array = Array.zeroCreate (hasher.GetDigestSize())
hasher.DoFinal(hash, 0) |> ignore
hash
我在 .net core 3.1 中找不到 RIPEMD160 的任何实现。
网络标准、Core 3.1不存在MS documentation for RIPEMD160 , 核心 5.0 .
在System.Security.Cryptography中找不到相关内容
在寻找第三方包之前(也许Chilkat)我想尝试使用框架库。
Microsoft 决定删除 .NET Core 中哈希和加密算法的“托管”(完全在 .NET 中实现)实现(不要问我为什么)。参见示例 https://github.com/dotnet/runtime/issues/2094(正好是关于 RIPEMD160):
RIPEMD160 is not an algorithm that is provided by the OS crypto layers, and .NET Core no longer carries managed implementations of cryptographic algorithms.
来自msdn:
All hash algorithm and hash-based message authentication (HMAC) classes, including the *Managed classes, defer to the OS libraries. While the various OS libraries differ in performance, they should be compatible.
我找不到是否有关于此的讨论,或者是否有某些经理决定最好以这种方式做或其他什么。
一个简单的解决方案是抓取 .NET 4.7/.NET 4.8 中使用的代码并直接使用:
代码源自 MIT,因此不存在许可问题,请参阅 homepage:
The files in this repository are licensed under the MIT license unless otherwise specified in the file header. If the file header only contains a copyright header (e.g., "Copyright (c) Microsoft Corporation. All rights reserved.", you can assume the associated file to be MIT-licensed.
我开始从 System.Security.Cryptography 复制一些 类 但是因为有很多属性和对其他 classes/interfaces 的依赖我不喜欢那个解决方案。
因为 Chilkat 看起来有点旧(netstandard 1.3)并且在项目中我已经在使用 BouncyCastle 所以最后我只写了这个:
type RIPEMD160 () =
static member ComputeHash (bytes: byte array) =
let hasher = Org.BouncyCastle.Crypto.Digests.RipeMD160Digest()
hasher.BlockUpdate(bytes, 0, bytes.Length)
let hash:byte array = Array.zeroCreate (hasher.GetDigestSize())
hasher.DoFinal(hash, 0) |> ignore
hash