Fnv1Hash64
Namespace: SnowBank.IO.Hashing · class
Helper for computing 64-bits FNV-1 hashes (FowlerNollVo)
Methods
Continue
static ulong Continue(ulong hash, byte[] bytes)
Continues computing the 64-bits FNV-1 hash on an additional chunk of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first chunk.bytes— New chunk of bytes to process
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, Slice bytes)
Continues computing the 64-bits FNV-1 hash on an additional chunk of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first chunk.bytes— New chunk of bytes to process
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, byte x)
Continues computing the 64-bits FNV-1 hash on the next byte of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first byte.x— Additional byte
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, short x)
Continues computing the 64-bits FNV-1 hash on the next two bytes of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first byte.x— Additional bytes
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, ushort x)
Continues computing the 64-bits FNV-1 hash on the next two bytes of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first byte.x— Additional bytes
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, int x)
Continues computing the 64-bits FNV-1 hash on the next four bytes of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first byte.x— Additional bytes
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, uint x)
Continues computing the 64-bits FNV-1 hash on the next four bytes of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first byte.x— Additional bytes
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, long x)
Continues computing the 64-bits FNV-1 hash on the next eight bytes of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first byte.x— Additional bytes
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, ulong x)
Continues computing the 64-bits FNV-1 hash on the next eight bytes of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first byte.x— Additional bytes
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, Guid x)
Continues computing the 64-bits FNV-1 hash on the next sixteen bytes of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first byte.x— Additional bytes
Returns: Updated FNV-1 64-bit hash that will include the additional data
static ulong Continue(ulong hash, byte[] buffer, int offset, int count)
Continues computing the 64-bits FNV-1 hash on an additional chunk of data
hash— Hash computed for all previous chunks, or the initial seed (FNV1_64_OFFSET_BASIS) if this is the first chunk.buffer— Backing store for the buffer that contains the bytes to processoffset— Offset of the first byte to processcount— Number of bytes to process
Returns: Updated FNV-1 64-bit hash that will include the additional data
FromByte
static ulong FromByte(byte x)
Computes the 64-bits FNV-1 hash of a Byte
Returns: Corresponding FNV-1 64-bit hash
FromBytes
static ulong FromBytes(byte[] bytes)
Computes the 64-bits FNV-1 hash of a byte array
bytes— Bytes to process
Returns: Corresponding FNV-1 64-bit hash
static ulong FromBytes(Slice bytes)
Computes the 64-bit FNV-1 hash of a block of data
bytes— Block of data
Returns: 64-bit hash computed over the entire array
static ulong FromBytes(ulong seed, byte[] bytes)
Computes the 64-bits FNV-1 hash of a byte array, with a custom initial seed
seed— Initial seed (0 for default)bytes— Bytes to process
Returns: Corresponding FNV-1 64-bit hash
static ulong FromBytes(byte[] bytes, int offset, int count)
Computes the 64-bit FNV-1 hash over a segment of data
bytes— Backing store for the buffer that contains the bytes to processoffset— Offset of the first byte to processcount— Number of bytes to process
Returns: Hash of the buffer section
FromChars
static ulong FromChars(char[] buffer, int offset, int count, Encoding encoding = null)
Computes the 64-bits FNV-1 hash of the utf-8 representation of a string
Returns: Corresponding FNV-1 64-bit hash
FromGuid
static ulong FromGuid(Guid value)
Computes the 64-bits FNV-1 hash of a Guid
Returns: Corresponding FNV-1 64-bit hash
FromInt16
static ulong FromInt16(short x)
Computes the 64-bits FNV-1 hash of a Int16
Returns: Corresponding FNV-1 64-bit hash
FromInt32
static ulong FromInt32(int x)
Computes the 64-bits FNV-1 hash of a Int32
Returns: Corresponding FNV-1 64-bit hash
FromInt64
static ulong FromInt64(long x)
Computes the 64-bits FNV-1 hash of a Int64
Returns: Corresponding FNV-1 64-bit hash
FromString
static ulong FromString(string text, bool ignoreCase, Encoding encoding = null)
Computes the 64-bits FNV-1 hash of the utf-8 representation of a string
text— String to processignoreCase— Iftrue, the string is converted to lowercase (invariant) before conversion to utf-8encoding— Encoding used to convert the string into bytes (utf-8 by default)
Returns: Corresponding FNV-1 64-bit hash
FromUInt16
static ulong FromUInt16(ushort x)
Computes the 64-bits FNV-1 hash of a UInt16
Returns: Corresponding FNV-1 64-bit hash
FromUInt32
static ulong FromUInt32(uint x)
Computes the 64-bits FNV-1 hash of a UInt32
Returns: Corresponding FNV-1 64-bit hash
FromUInt64
static ulong FromUInt64(ulong x)
Computes the 64-bits FNV-1 hash of a UInt64
Returns: Corresponding FNV-1 64-bit hash
Fields
FNV1_64_OFFSET_BASIS
const ulong FNV1_64_OFFSET_BASIS
FNV1_64_PRIME
const ulong FNV1_64_PRIME