TableSeed structv0.1.0
pub struct TableSeed {
// private fields
}
Two words, which is what SipHash takes as a key. Drawing one per table costs a system call each; a program
making many should draw one and hand it to all of them, which is what this being a value rather than a hidden
global is for.
Associated functions
Random
pub func Random() -> TableSeed
A seed drawn from the operating system. Takes nothing. Falls back to a fixed pair of words when the system has no entropy to give, which keeps a table working on a system without a generator at the cost of the protection the seed exists for — a table keyed on adversarial input on such a system is as attackable as an unseeded one. Runs in constant time and allocates nothing.
Returns: a seed drawn from the system, so two tables in one process iterate differently
Of
pub func Of(low: uint64, high: uint64) -> TableSeed
A seed with the words a caller chose.
low and high are read by value. For a test that needs the same table twice, or a caller drawing one seed
for many tables.
| Name | Type | Description |
|---|---|---|
low | uint64 | the first seed word |
high | uint64 | the second |
Returns: a seed made of those two words, which makes the iteration order reproducible