Class FNV1a<THash, TParameters>
Represents FNV-1a hash algorithm.
Implements
Inherited Members
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 SourceFNV1a(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
Methods
| Edit this page View SourceAppend(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
| Edit this page View SourceAppend(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. |
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. |
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. |
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. |
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
| Edit this page View SourceHash(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. |
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. |
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. |
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 |
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. |
Reset()
When overridden in a derived class, resets the hash computation to the initial state.
Declaration
public override sealed void Reset()