HashAlgorithm.HashCore 方法

定义

重载

HashCore(Byte[], Int32, Int32)

当在派生类中重写时,将写入对象的数据路由到哈希算法以计算哈希值。

HashCore(ReadOnlySpan<Byte>)

将写入对象的数据路由到哈希算法以计算哈希值。

HashCore(Byte[], Int32, Int32)

Source:
HashAlgorithm.cs
Source:
HashAlgorithm.cs
Source:
HashAlgorithm.cs

当在派生类中重写时,将写入对象的数据路由到哈希算法以计算哈希值。

C#
protected abstract void HashCore(byte[] array, int ibStart, int cbSize);

参数

array
Byte[]

要计算其哈希代码的输入。

ibStart
Int32

字节数组中的偏移量,从该位置开始使用数据。

cbSize
Int32

字节数组中用作数据的字节数。

注解

应用程序代码不调用此方法。

此抽象方法执行哈希计算。 每次写入加密哈希算法时,都会通过此方法传递数据。 对于每个数据块,此方法更新哈希对象的状态,以便在数据末尾返回正确的哈希值。

适用于

.NET 10 和其他版本
产品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1

HashCore(ReadOnlySpan<Byte>)

Source:
HashAlgorithm.cs
Source:
HashAlgorithm.cs
Source:
HashAlgorithm.cs

将写入对象的数据路由到哈希算法以计算哈希值。

C#
protected virtual void HashCore(ReadOnlySpan<byte> source);

参数

source
ReadOnlySpan<Byte>

要计算其哈希代码的输入。

注解

此方法的默认实现将复制到 source 临时数组并调用 HashCore(Byte[], Int32, Int32)

派生类型应重写此方法以避免中间数据复制。

适用于

.NET 10 和其他版本
产品 版本
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1