Skip to content

Hash

Spice
import "std/math/hash";

Functions

combineHashes

Spice
public f<Hash> combineHashes(Hash h1, Hash h2)

Combine two hash values to form a new one.

Parameters

Name Type Description
h1 Hash Hash value 1
h2 Hash Hash value 2

Returns: Hash — Resulting hash value, that combines h1 and h2

hash

Spice
public f<Hash> hash<TriviallyHashableT>(TriviallyHashableT input)

Hash primitive numeric type

Parameters

Name Type Description
input TriviallyHashableT Primitive numeric to hash

Returns: Hash — Hash of primitive numeric

hash

Spice
public f<Hash> hash<TriviallyHashableWithCastT>(TriviallyHashableWithCastT input)

Hash primitive numeric type

Parameters

Name Type Description
input TriviallyHashableWithCastT Primitive numeric to hash

Returns: Hash — Hash of primitive numeric

hash

Spice
public f<Hash> hash(long input)

Hash primitive numeric type

Parameters

Name Type Description
input long Primitive numeric to hash

Returns: Hash — Hash of primitive numeric

hash

Spice
public f<Hash> hash(bool input)

Hash bool type

Parameters

Name Type Description
input bool Bool to hash

Returns: Hash — Hash of bool

hash

Spice
public f<Hash> hash(double input)

Hash a double value

Parameters

Name Type Description
input double Double to hash

Returns: Hash — Hash of double

hash

Spice
public f<Hash> hash(string input)

Hash contents of an immutable string

Parameters

Name Type Description
input string String to hash

Returns: Hash — Hash of string

hash

Spice
public f<Hash> hash(const String& input)

Hash contents of a mutable String object

Parameters

Name Type Description
input const String& String to hash

Returns: Hash — Hash of string

hash

Spice
public f<Hash> hash(const IHashable& hashable)

Dispatch function for structs, that implement the IHashable interface

Parameters

Name Type Description
hashable const IHashable& Hashable object

Returns: Hash — Hash of the struct

IHashable interface

Interface for types that can produce a hash value of themselves, e.g. for use as keys in hash-based containers like UnorderedMap and UnorderedSet.

hash

Spice
public f<Hash> hash()

Returns: Hash

Hash alias

Alias for unsigned long.