Module shakmaty::zobrist

source ·
Expand description

Zobrist hashing for positions.

Stability

The Zobrist hash for each position is guaranteed to be stable. Changing hash values is considered a semver breaking change and will be noted in the changelog.

Warning: Forged collisions

Zobrist hashes have good collision resistance, but can be forged efficiently.

Additionally, in this implementation, impossible positions with more than standard material in Crazyhouse pockets are particularly prone to collisions.

Examples

use shakmaty::{Chess, EnPassantMode, zobrist::{Zobrist64, ZobristHash}};

let pos = Chess::default();
assert_eq!(pos.zobrist_hash::<Zobrist64>(EnPassantMode::Legal), Zobrist64(0x463b96181691fc9c));

Structs

A ZobristValue with 8 bits.
A ZobristValue with 16 bits.
A ZobristValue with 32 bits.
A ZobristValue with 64 bits.
A ZobristValue with 128 bits.

Traits

Supports Zobrist hashing.
Integer type that can be returned as a Zobrist hash.