Expand description
CRC32C hashing for component validation. CRC32C hashing for component validation.
Minecraft uses CRC32C (Castagnoli) checksums to validate component data
in serverbound packets. This module provides a hasher that matches
Minecraft’s HashOps implementation exactly.
§Type Tags
Minecraft prefixes each value with a type tag byte before hashing:
- Primitives: TAG_BYTE, TAG_SHORT, TAG_INT, TAG_LONG, TAG_FLOAT, TAG_DOUBLE
- Boolean: TAG_BOOLEAN followed by 0x00 or 0x01
- String: TAG_STRING followed by length (i32 BE) and UTF-8 bytes
- Collections use start/end markers: TAG_MAP_START/END, TAG_LIST_START/END
All numeric values are little-endian (matching Guava’s Hasher).
Structs§
- Component
Hasher - A CRC32C hasher for component values.
- Hash
Entry - A hash entry for map sorting.
Enums§
- HashTag
- Type tags matching Minecraft’s
HashOpsimplementation.
Traits§
- Hash
Component - Trait for types that can be hashed for component validation.
Functions§
- sort_
map_ entries - Sorts map entries according to Minecraft’s ordering: First by key hash, then by value hash (both as padded longs).