Standard Library / Hash
Hash
Utilities for hashing any value.
Edit on GitHubAdded in 0.1.0
No other changes yet.
from "hash" include Hash
Hash.hash(1)
Hash.hash("Hello World")
Functions and constants included in the Hash module.
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:
| param | type | description |
|---|---|---|
anything | a | The value to hash |
anything: The value to hashReturns:
| type | description |
|---|---|
Number | A hash for the given value |
Number: A hash for the given valueThrows:
Failure(String)
- If WASI random_get fails
Examples:
assert Hash.hash(1) == Hash.hash(1)
assert Hash.hash("Hello World") == Hash.hash("Hello World")