XxHashExtensions

Namespace: System.IO.Hashing · class

Extension methods for computing XxHash values

Methods

HashToUInt128

static UInt128 HashToUInt128(Slice bytes, int seed = 0)

Computes the XxHash128 hash of the provided data

  • bytes — The data to hash
  • seed — The seed value for this hash computation. The default is zero.

Returns: The computed XxHash128 hash.

static UInt128 HashToUInt128(string text, int seed = 0, Encoding encoding = null)

Computes the XxHash128 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash128 hash.

static UInt128 HashToUInt128(ReadOnlySpan<char> text, int seed = 0, Encoding encoding = null)

Computes the XxHash128 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash128 hash.

static UInt128 HashToUInt128(ref DefaultInterpolatedStringHandler text, int seed = 0, Encoding encoding = null)

Computes the XxHash128 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash128 hash.

HashToUInt32

static uint HashToUInt32(Slice bytes, int seed = 0)

Computes the XxHash32 hash of the provided data

  • bytes — The data to hash
  • seed — The seed value for this hash computation. The default is zero.

Returns: The computed XxHash32 hash.

static uint HashToUInt32(string text, int seed = 0, Encoding encoding = null)

Computes the XxHash32 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash32 hash.

static uint HashToUInt32(ReadOnlySpan<char> text, int seed = 0, Encoding encoding = null)

Computes the XxHash32 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash32 hash.

static uint HashToUInt32(ref DefaultInterpolatedStringHandler text, int seed = 0, Encoding encoding = null)

Computes the XxHash32 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash32 hash.

HashToUInt64

static ulong HashToUInt64(Slice bytes, int seed = 0)

Computes the XxHash64 hash of the provided data

  • bytes — The data to hash
  • seed — The seed value for this hash computation. The default is zero.

Returns: The computed XxHash64 hash.

static ulong HashToUInt64(string text, int seed = 0, Encoding encoding = null)

Computes the XxHash64 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash64 hash.

static ulong HashToUInt64(ReadOnlySpan<char> text, int seed = 0, Encoding encoding = null)

Computes the XxHash64 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash64 hash.

static ulong HashToUInt64(ref DefaultInterpolatedStringHandler text, int seed = 0, Encoding encoding = null)

Computes the XxHash64 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash64 hash.

HashToUid128

static Uuid128 HashToUid128(ReadOnlySpan<char> text, int seed = 0, Encoding encoding = null)

Computes the XxHash128 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash128 hash.

HashToUuId128

static Uuid128 HashToUuId128(string text, int seed = 0, Encoding encoding = null)

Computes the XxHash128 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash128 hash.

static Uuid128 HashToUuId128(ref DefaultInterpolatedStringHandler text, int seed = 0, Encoding encoding = null)

Computes the XxHash128 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash128 hash.

HashToUuid64

static Uuid64 HashToUuid64(string text, int seed = 0, Encoding encoding = null)

Computes the XxHash64 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash64 hash.

static Uuid64 HashToUuid64(ReadOnlySpan<char> text, int seed = 0, Encoding encoding = null)

Computes the XxHash64 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash64 hash.

static Uuid64 HashToUuid64(ref DefaultInterpolatedStringHandler text, int seed = 0, Encoding encoding = null)

Computes the XxHash64 hash of the provided text

  • text — The text to hash
  • seed — The seed value for this hash computation. The default is zero.
  • encoding — Encoding used to convert the text to bytes (UTF-8 by default)

Returns: The computed XxHash64 hash.