serpent-os / moss

The safe, fast and sane package manager for Linux
https://serpentos.com
119 stars 12 forks source link

Support BLAKE3 #49

Open ikeycode opened 10 months ago

ikeycode commented 10 months ago

We've relied heavily on SHA-256 in the past, but would like to move PackageHash to be based on BLAKE3 going forwards. We also need this for verification routines

ReillyBrogan commented 10 months ago

The hash algorithm used should be specified in any manifests, allowing for usage of multiple hash types (even if Serpent only ever uses Blake3). It should be possible to have a system composed of packages using mixed hash types. Such a feature would facilitate a migration if (somehow) Blake3 is ever considered broken and we must migrate away. Supporting alternate hash types would also make the tooling more interesting to projects like composefs which may wish to share a content addressable store between the container images and the host fs.

ikeycode commented 10 months ago

Would it make sense then to deprecate PackageHash and add TypedPackageHash which was prefaced with the hash algo? i. 3$string0 - with PackageHash being SHA256Hash - permalocked

ikeycode commented 10 months ago

Note that internally v1 storage hashes are locked to XXH3_128 - but we can obviously refine this in V2 with a type field

ikeycode commented 10 months ago

I also feel like there is a tooling opportunity here to interact with the roots + caches and export relevant hash types (probably for #19 ?)