Skip to content

Add the hash datatype - #65

Open
u9g wants to merge 1 commit into
masterfrom
hash-type
Open

Add the hash datatype#65
u9g wants to merge 1 commit into
masterfrom
hash-type

Conversation

@u9g

@u9g u9g commented Sep 6, 2026

Copy link
Copy Markdown

Adds `hash`: `["hash", { "alg": String, "type": Type, "body": Type }]`. Writing serializes the value as `body`, hashes the bytes with `alg` and writes the digest as `type`; reading yields the digest. It is a one-way field for protocols that carry a checksum of something in place of the thing itself, such as Minecraft's `HashedSlot` (a CRC32C per item component since 1.21.5).

`crc32` and `crc32c` are integer digests; when `type` is signed the hash is written in two's complement. Other algorithms are whatever the platform's crypto provides and produce raw digest bytes, so `type` is then a fixed-length `buffer`.

Schema, datatype reference and docs. Implementation: ProtoDef-io/node-protodef (PR to follow, linked below).

Context: PrismarineJS/prismarine-item#184 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant