Skip to content

Class Crc32

Namespace: Tool.Utils
Assembly: Tool.Net.dll

提供 CRC32 算法的实现

csharp
public class Crc32 : HashAlgorithm, ICryptoTransform, IDisposable

Inheritance

objectHashAlgorithmCrc32

Implements

ICryptoTransform, IDisposable

Inherited Members

HashAlgorithm.HashSizeValue, HashAlgorithm.HashValue, HashAlgorithm.State, HashAlgorithm.Clear(), HashAlgorithm.ComputeHash(byte[]), HashAlgorithm.ComputeHash(byte[], int, int), HashAlgorithm.ComputeHash(Stream), HashAlgorithm.ComputeHashAsync(Stream, CancellationToken), HashAlgorithm.Create(), HashAlgorithm.Create(string), HashAlgorithm.Dispose(), HashAlgorithm.Dispose(bool), HashAlgorithm.HashCore(byte[], int, int), HashAlgorithm.HashCore(ReadOnlySpan<byte>), HashAlgorithm.HashFinal(), HashAlgorithm.Initialize(), HashAlgorithm.TransformBlock(byte[], int, int, byte[]?, int), HashAlgorithm.TransformFinalBlock(byte[], int, int), HashAlgorithm.TryComputeHash(ReadOnlySpan<byte>, Span<byte>, out int), HashAlgorithm.TryHashFinal(Span<byte>, out int), HashAlgorithm.CanReuseTransform, HashAlgorithm.CanTransformMultipleBlocks, HashAlgorithm.Hash, HashAlgorithm.HashSize, HashAlgorithm.InputBlockSize, HashAlgorithm.OutputBlockSize, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods

ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)

Remarks

代码由逆血提供支持

Constructors

Crc32()

csharp
public Crc32()

Crc32(uint, uint)

csharp
public Crc32(uint polynomial, uint seed)

Parameters

polynomial uint

seed uint

Fields

DefaultPolynomial

csharp
public const uint DefaultPolynomial = 3988292384

Field Value

uint

DefaultSeed

csharp
public const uint DefaultSeed = 4294967295

Field Value

uint

Methods

Compute(byte[])

csharp
public static uint Compute(byte[] buffer)

Parameters

buffer byte[]

Returns

uint

Compute(uint, byte[])

csharp
public static uint Compute(uint seed, byte[] buffer)

Parameters

seed uint

buffer byte[]

Returns

uint

Compute(uint, uint, byte[])

csharp
public static uint Compute(uint polynomial, uint seed, byte[] buffer)

Parameters

polynomial uint

seed uint

buffer byte[]

Returns

uint

HashCore(byte[], int, int)

csharp
protected override void HashCore(byte[] buffer, int start, int length)

Parameters

buffer byte[]

start int

length int

HashFinal()

csharp
protected override byte[] HashFinal()

Returns

byte[]

Initialize()

初始化参数

csharp
public override void Initialize()

基于Apache-2.0协议开源