# `Slap.Cluster.Hash`
[🔗](https://github.com/mjrusso/slap/blob/slap_cluster-v0.4.0/slap_cluster/lib/slap/cluster/hash.ex#L1)

XXH64 (xxHash, 64-bit), for placing keys on shards.

`shard_for/2` is pinned forever: changing it moves every key to a different
shard. It matches the reference implementation (checked against the
`twox-hash` crate in the tests).

# `shard_for`

```elixir
@spec shard_for(binary(), pos_integer()) :: non_neg_integer()
```

The shard for `key`: `xxh64(key, 0) mod shards`.

# `xxh64`

```elixir
@spec xxh64(binary(), non_neg_integer()) :: non_neg_integer()
```

XXH64 of `data` with `seed`, as an unsigned 64-bit integer.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
