Show / Hide Table of Contents

Class FNV1a<THash, TParameters>

Represents FNV-1a hash algorithm.

Inheritance
object
NonCryptographicHashAlgorithm
FNV1a<THash, TParameters>
FNV1a128
FNV1a32
FNV1a64
Implements
IResettable
Inherited Members
NonCryptographicHashAlgorithm.Append(byte[])
NonCryptographicHashAlgorithm.Append(Stream)
NonCryptographicHashAlgorithm.AppendAsync(Stream, CancellationToken)
NonCryptographicHashAlgorithm.TryGetCurrentHash(Span<byte>, out int)
NonCryptographicHashAlgorithm.GetCurrentHash(Span<byte>)
NonCryptographicHashAlgorithm.GetHashAndReset()
NonCryptographicHashAlgorithm.TryGetHashAndReset(Span<byte>, out int)
NonCryptographicHashAlgorithm.GetHashAndReset(Span<byte>)
NonCryptographicHashAlgorithm.GetHashAndResetCore(Span<byte>)
NonCryptographicHashAlgorithm.HashLengthInBytes
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.IO.Hashing
Assembly: DotNext.dll
Syntax
public class FNV1a<THash, TParameters> : NonCryptographicHashAlgorithm, IResettable where THash : unmanaged, IBinaryNumber<THash> where TParameters : IFNV1aParameters<THash>
Type Parameters
Name Description
THash

The type representing hash value.

TParameters

The parameters of the algorithm.

Constructors

| Edit this page View Source

FNV1a(bool)

Represents FNV-1a hash algorithm.

Declaration
public FNV1a(bool salted = false)
Parameters
Type Name Description
bool salted

true to include randomized salt data into hashing; false to use data from memory only.

See Also
FNV-1a

Methods

| Edit this page View Source

Append(ReadOnlySpan<byte>)

When overridden in a derived class, appends the contents of source to the data already processed for the current hash computation.

Declaration
public override sealed void Append(ReadOnlySpan<byte> source)
Parameters
Type Name Description
ReadOnlySpan<byte> source

The data to process.

Overrides
NonCryptographicHashAlgorithm.Append(ReadOnlySpan<byte>)
| Edit this page View Source

Append(void*, nuint)

Appends the contents of unmanaged memory to the data already processed for the current hash computation.

Declaration
[CLSCompliant(false)]
public void Append(void* address, nuint length)
Parameters
Type Name Description
void* address

The address of the unmanaged memory.

nuint length

The length of the unmanaged memory block, in bytes.

| Edit this page View Source

Append(THash)

Appends the value to the data already processed for the current hash computation.

Declaration
public void Append(THash value)
Parameters
Type Name Description
THash value

The value to be hashed.

| Edit this page View Source

Append<T>(ReadOnlySpan<T>)

Appends the contents of source to the data already processed for the current hash computation.

Declaration
public void Append<T>(ReadOnlySpan<T> source) where T : unmanaged
Parameters
Type Name Description
ReadOnlySpan<T> source

The data to process.

Type Parameters
Name Description
T

The type of the span elements.

| Edit this page View Source

GetCurrentHash()

Gets the current computed hash value without modifying accumulated state.

Declaration
public THash GetCurrentHash()
Returns
Type Description
THash

The hash value for the data already provided.

| Edit this page View Source

GetCurrentHashCore(Span<byte>)

When overridden in a derived class, writes the computed hash value to destination without modifying accumulated state.

Declaration
protected override sealed void GetCurrentHashCore(Span<byte> destination)
Parameters
Type Name Description
Span<byte> destination

The buffer that receives the computed hash value.

Overrides
NonCryptographicHashAlgorithm.GetCurrentHashCore(Span<byte>)
| Edit this page View Source

Hash(void*, nuint, bool)

Computes hash code for the specified block of unmanaged memory.

Declaration
[CLSCompliant(false)]
public static THash Hash(void* address, nuint length, bool salted = false)
Parameters
Type Name Description
void* address

The address of the unmanaged memory.

nuint length

The length of the unmanaged memory block, in bytes.

bool salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
THash

The computed FNV-1a hash.

| Edit this page View Source

Hash(THash)

Computes a hash for a value of type THash.

Declaration
public static THash Hash(THash data)
Parameters
Type Name Description
THash data

The data to be hashed.

Returns
Type Description
THash

The computed FNV-1a hash.

| Edit this page View Source

Hash<T>(ReadOnlySpan<T>, bool)

Computes hash code over the span of elements.

Declaration
public static THash Hash<T>(ReadOnlySpan<T> data, bool salted = false) where T : unmanaged
Parameters
Type Name Description
ReadOnlySpan<T> data

The data to be hashed.

bool salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
THash

The computed FNV-1a hash.

Type Parameters
Name Description
T

The type of the elements.

| Edit this page View Source

Hash<T, TIndex>(Func<T, TIndex, THash>, TIndex, T, bool)

Computes hash code over elements returned by vector accessor.

Declaration
public static THash Hash<T, TIndex>(Func<T, TIndex, THash> accessor, TIndex count, T arg, bool salted = false) where TIndex : IComparisonOperators<TIndex, TIndex, bool>, IAdditiveIdentity<TIndex, TIndex>, IIncrementOperators<TIndex>
Parameters
Type Name Description
Func<T, TIndex, THash> accessor

The delegate that provided access to the element of type THash at the given index.

TIndex count

The number of elements in the vector.

T arg

The argument to be passed to the accessor.

bool salted

true to include randomized salt data into hashing; false to use data from memory only.

Returns
Type Description
THash

The computed FNV-1a hash.

Type Parameters
Name Description
T

The type of the elements in the vector.

TIndex

The type that is used as identifier of the elements in the vector.

| Edit this page View Source

Reset()

When overridden in a derived class, resets the hash computation to the initial state.

Declaration
public override sealed void Reset()
Overrides
NonCryptographicHashAlgorithm.Reset()

Implements

IResettable

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)

See Also

FNV-1a
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾