Hash

GitHub   Edit on GitHub

Utilities for hashing any value.

Added in 0.1.0 No other changes yet.
1
from "hash" include Hash
1
Hash.hash(1)
1
Hash.hash("Hello World")

Values

Functions and constants included in the Hash module.

Hash.hash

Added in 0.1.0 No other changes yet.
1
hash : (anything: a) => Number

A generic hash function that produces an integer from any value. If a == b then Hash.hash(a) == Hash.hash(b).

Parameters:

param type description
anything a The value to hash

Returns:

type description
Number A hash for the given value

Throws:

Failure(String)

  • If WASI random_get fails

Examples:

1
assert Hash.hash(1) == Hash.hash(1)
1
assert Hash.hash("Hello World") == Hash.hash("Hello World")
This is a notification!