refactor(tvix/nix-compat): use hash_with_mode's nix_hash_string

HashWithMode already provides a to_nix_hash_string() method, giving us
exactly the string we need here.

Change-Id: Id2635bf3ea6c2514faf3c26b297866d774f4ff4a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9799
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-10-18 11:32:31 +01:00 committed by flokli
parent 1bb7e84241
commit 57b69baf7c

View file

@ -89,13 +89,7 @@ pub fn build_regular_ca_path<S: AsRef<str>, I: IntoIterator<Item = S>>(
&{
let content_digest = {
let mut hasher = Sha256::new_with_prefix("fixed:out:");
hasher.update(hash_with_mode.mode().prefix());
hasher.update(hash_with_mode.digest().algo().to_string());
hasher.update(":");
hasher.update(
&data_encoding::HEXLOWER
.encode(hash_with_mode.digest().digest_as_bytes()),
);
hasher.update(hash_with_mode.to_nix_hash_string());
hasher.update(":");
hasher.finalize()
};