1const std = @import("std");
2
3/// This is 128 bits - Even with 2^54 cache entries, the probability of a collision would be under 10^-6
4pub const bin_digest_len = 16;
5pub const hex_digest_len = bin_digest_len * 2;
6pub const BinDigest = [bin_digest_len]u8;
7pub const HexDigest = [hex_digest_len]u8;
8
9pub const HashHelper = std.Build.Cache.HashHelper;
10
11/// From Zig std.Build.Cache:
12/// The type used for hashing file contents. Currently, this is SipHash128(1, 3), because it
13/// provides enough collision resistance for the Manifest use cases, while being one of our
14/// fastest options right now.
15pub const Hasher = std.crypto.auth.siphash.SipHash128(1, 3);
16
17/// From Zig std.Build.Cache:
18/// Initial state with random bytes, that can be copied.
19/// Refresh this with new random bytes when the manifest
20/// format is modified in a non-backwards-compatible way.
21pub const hasher_init: Hasher = Hasher.init(&[_]u8{
22 0x33, 0x52, 0xa2, 0x84,
23 0xcf, 0x17, 0x56, 0x57,
24 0x01, 0xbb, 0xcd, 0xe4,
25 0x77, 0xd6, 0xf0, 0x60,
26});