diff --git a/snix/nix-compat/src/nixhash/ca_hash.rs b/snix/nix-compat/src/nixhash/ca_hash.rs index e6cbaf5b7..1d4d65e4e 100644 --- a/snix/nix-compat/src/nixhash/ca_hash.rs +++ b/snix/nix-compat/src/nixhash/ca_hash.rs @@ -85,9 +85,9 @@ impl CAHash { } "fixed" => { if let Some(s) = s.strip_prefix("r:") { - NixHash::from_nix_hex_str(s).map(CAHash::Nar) + NixHash::from_nix_nixbase32_str(s).map(CAHash::Nar) } else { - NixHash::from_nix_hex_str(s).map(CAHash::Flat) + NixHash::from_nix_nixbase32_str(s).map(CAHash::Flat) } } _ => None, diff --git a/snix/nix-compat/src/nixhash/mod.rs b/snix/nix-compat/src/nixhash/mod.rs index 9cb6f6605..07720e7ff 100644 --- a/snix/nix-compat/src/nixhash/mod.rs +++ b/snix/nix-compat/src/nixhash/mod.rs @@ -73,9 +73,9 @@ impl NixHash { } } - /// Constructs a [NixHash] from the Nix default hash format, - /// the inverse of [Self::to_nix_hex_string]. - pub fn from_nix_hex_str(s: &str) -> Option { + /// Constructs a new [NixHash] from the Nix default hash format, + /// the inverse of [Self::to_nix_nixbase32_string]. + pub fn from_nix_nixbase32_str(s: &str) -> Option { let (tag, digest) = s.split_once(':')?; (match tag { @@ -98,7 +98,7 @@ impl NixHash { /// Formats a [NixHash] in the format that's used inside CAHash, /// which is the algo, followed by a colon, then the nixbase32-encoded digest. - pub(crate) fn to_nix_nixbase32_string(&self) -> String { + pub fn to_nix_nixbase32_string(&self) -> String { format!( "{}:{}", self.algo(),