tvl-depot/tvix/nix-compat/src/nixhash
Florian Klink 7a84a8fe89 fix(nix-compat/nix-hash): relax padding requirements
Nix is quite tolerant when it comes to parsing SRI hashes and their
padding (and only for SRI hashes, it funnily is strict about that in the
non-SRI-hash case).

Nix essentially accepts any number of padding characters, no matter if
it's too much or too little. So we do the only sane thing - simply strip
all padding characters, and parse it with BASE64_NOPAD and the length
the algo uses.

Change-Id: I6a721aa289b06cc36741589792b9dd4c4f930b86
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10468
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2024-01-03 13:01:02 +00:00
..
algos.rs refactor(tvix/nix-compat): make NixHash an enum with fixed-len bytes 2023-10-14 17:55:08 +00:00
ca_hash.rs refactor(tvix/nix-compat): cleanup parse_{ca,hash} and fmt structs 2023-11-22 17:54:59 +00:00
mod.rs fix(nix-compat/nix-hash): relax padding requirements 2024-01-03 13:01:02 +00:00