ESC
No recent searches
Search by
Standard Library  /  Hash

Hash

Utilities for hashing any value.

Edit on GitHub
Added in 0.1.0 No other changes yet.
from "hash" include Hash
Hash.hash(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.
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:

anything: The value to hash

Returns:

Number: A hash for the given value

Throws:

Failure(String)

  • If WASI random_get fails

Examples:

assert Hash.hash(1) == Hash.hash(1)
assert Hash.hash("Hello World") == Hash.hash("Hello World")

Sign up for farm-to-inbox developer news

You can unsubscribe at any time. Read our privacy policy.

Copyright © 2024 The Grain Programming Language