From 57b69baf7c8891f0032ef70415482f9a38396bb7 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 18 Oct 2023 11:32:31 +0100 Subject: 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 Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/nix-compat/src/store_path/utils.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tvix/nix-compat/src/store_path/utils.rs b/tvix/nix-compat/src/store_path/utils.rs index 6064bb36b3b3..b774fbdb662d 100644 --- a/tvix/nix-compat/src/store_path/utils.rs +++ b/tvix/nix-compat/src/store_path/utils.rs @@ -89,13 +89,7 @@ pub fn build_regular_ca_path, I: IntoIterator>( &{ 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() }; -- cgit 1.4.1