Skip to content

Commit

Permalink
If encoding is unspecified, just use hex.
Browse files Browse the repository at this point in the history
This is deep in the code, its validated much higher up
  • Loading branch information
lookbusy1344 committed May 2, 2024
1 parent 97c71ea commit 0ea36ac
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn hash_file_encoded<D: Digest>(
let h = hash_file::<D>(filename)?;

let encoded = match encoding {
OutputEncoding::Hex => hex::encode(h),
OutputEncoding::Hex | OutputEncoding::Unspecified => hex::encode(h),
OutputEncoding::Base64 => BASE64.encode(&h),
OutputEncoding::Base32 => BASE32.encode(&h),
OutputEncoding::U32 => {
Expand All @@ -71,9 +71,6 @@ pub fn hash_file_encoded<D: Digest>(
let number = BigEndian::read_u32(&h);
format!("{number:010}")
}
OutputEncoding::Unspecified => {
return Err(anyhow::anyhow!("Unknown encoding"));
}
};

Ok(BasicHash(encoded))
Expand Down

0 comments on commit 0ea36ac

Please sign in to comment.