Show / Hide Table of Contents

Class Farmhash

Class that can calculate 32bit and 64bit hashes using Google's farmhash algorithm

Inheritance
System.Object
Farmhash
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Farmhash.Sharp
Assembly: Farmhash.Sharp.dll
Syntax
public static class Farmhash

Methods

Hash32(Byte*, Int32)

Calculates a 32bit hash from a given byte array upto a certain length

Declaration
public static uint Hash32(byte *s, int length)
Parameters
Type Name Description
System.Byte* s

pointer to bytes that contain at least len bytes

System.Int32 length

number of bytes to consume to calculate hash

Returns
Type Description
System.UInt32

A 32bit hash

Hash32(Byte[], Int32)

Calculates a 32bit hash from a given byte array upto a certain length

Declaration
public static uint Hash32(byte[] s, int length)
Parameters
Type Name Description
System.Byte[] s

Byte array to calculate the hash on

System.Int32 length

Number of bytes from the buffer to calculate the hash with

Returns
Type Description
System.UInt32

A 32bit hash

Hash32(ReadOnlySpan<Byte>)

Calculates the 32bit from a readonly span of byte data

Declaration
public static uint Hash32(ReadOnlySpan<byte> span)
Parameters
Type Name Description
System.ReadOnlySpan<System.Byte> span

span of data to hash

Returns
Type Description
System.UInt32

A 32bit hash

Hash32(String)

Calculates a 32bit hash from a given string.

See the article on strings for longform explanation

Declaration
public static uint Hash32(string s)
Parameters
Type Name Description
System.String s

String to hash

Returns
Type Description
System.UInt32

A 32bit hash

Hash64(Byte*, Int32)

Calculates a 64bit hash from a given byte array upto a certain length

Declaration
public static ulong Hash64(byte *s, int length)
Parameters
Type Name Description
System.Byte* s

pointer to bytes that contain at least len bytes

System.Int32 length

number of bytes to consume to calculate hash

Returns
Type Description
System.UInt64

A 64bit hash

Hash64(Byte[], Int32)

Calculates a 64bit hash from a given byte array upto a certain length

Declaration
public static ulong Hash64(byte[] s, int length)
Parameters
Type Name Description
System.Byte[] s

Byte array to calculate the hash on

System.Int32 length

Number of bytes from the buffer to calculate the hash with

Returns
Type Description
System.UInt64

A 64bit hash

Hash64(ReadOnlySpan<Byte>)

Calculates the 64bit from a readonly span of byte data

Declaration
public static ulong Hash64(ReadOnlySpan<byte> span)
Parameters
Type Name Description
System.ReadOnlySpan<System.Byte> span

span of data to hash

Returns
Type Description
System.UInt64

A 64bit hash

Hash64(String)

Calculates a 64bit hash from a given string.

See the article on strings for longform explanation

Declaration
public static ulong Hash64(string s)
Parameters
Type Name Description
System.String s

String to hash

Returns
Type Description
System.UInt64

A 64bit hash

Back to top Copyright © 2015-. Contributors of Farmhash.Sharp