How does .fingerprint work?

Hello,
today I updated a project of mine and started wondering how .fingerprint works, but couldnt find any information that to me truly explains what properties it needs to have in order to work the way it does and how it guarantees these.

Im sorry for the vague question Ive just never really thought about something like this before and wanna learn about it.

It’s explained here: 0.14.0 Release Notes ⚡ The Zig Programming Language

PR with discussions: implement new package hash format: `$name-$semver-$hash` by andrewrk · Pull Request #22994 · ziglang/zig · GitHub

8 Likes

From the release notes

name and version are limited to 32 bytes.

32 bytes each or name++version combined?

Each, not combined. From the code:

pub const max_len = 32 + 1 + 32 + 1 + 12;

these are name + separator + version + separator + hash.

IIRC, hash is 200 bits which cannot be represented in 12 bytes in the code you quoted.

It’s a digest, not the complete hash