From 585dbe4eae1b81ff18fc8dcaadbd120d01d24b18 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 15 Jan 2024 01:31:16 -0500 Subject: [PATCH] keyfork-{frame, slip10-test-data}: remove hex --- Cargo.lock | 3 +- crates/util/keyfork-frame/Cargo.toml | 1 - crates/util/keyfork-frame/src/lib.rs | 9 +- .../util/keyfork-slip10-test-data/Cargo.toml | 4 +- .../util/keyfork-slip10-test-data/src/lib.rs | 200 +++++++++--------- 5 files changed, 105 insertions(+), 112 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99265ae..57aff74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1768,7 +1768,6 @@ version = "0.1.0" name = "keyfork-frame" version = "0.1.0" dependencies = [ - "hex", "insta", "sha2", "thiserror", @@ -1843,7 +1842,7 @@ dependencies = [ name = "keyfork-slip10-test-data" version = "0.1.0" dependencies = [ - "hex", + "smex", ] [[package]] diff --git a/crates/util/keyfork-frame/Cargo.toml b/crates/util/keyfork-frame/Cargo.toml index fb0a2ed..4b9c5ca 100644 --- a/crates/util/keyfork-frame/Cargo.toml +++ b/crates/util/keyfork-frame/Cargo.toml @@ -16,7 +16,6 @@ sha2 = "0.10.7" # Personally audited thiserror = "1.0.47" -hex = "0.4.3" # Optional, not personally audited tokio = { version = "1.32.0", optional = true, features = ["io-util"] } diff --git a/crates/util/keyfork-frame/src/lib.rs b/crates/util/keyfork-frame/src/lib.rs index 3d18bc6..649cb31 100644 --- a/crates/util/keyfork-frame/src/lib.rs +++ b/crates/util/keyfork-frame/src/lib.rs @@ -34,8 +34,8 @@ pub enum DecodeError { IncorrectLength(usize, u32), /// The provided checksum of the data did not match the locally-generated checksum. - #[error("Checksum did not match: Their {0} != Our {1}")] - BadChecksum(String, String), + #[error("Checksum did not match: Their {0:X?} != Our {1:X?}")] + BadChecksum(Vec, Vec), /// Data could not be read from the input source. #[error("Data could not be read from the input source: {0}")] @@ -88,10 +88,7 @@ pub(crate) fn verify_checksum(data: &[u8]) -> Result<&[u8], DecodeError> { let content = &data[32..]; let our_checksum = hash(content); if our_checksum != checksum { - return Err(DecodeError::BadChecksum( - hex::encode(checksum), - hex::encode(our_checksum), - )); + return Err(DecodeError::BadChecksum(checksum.to_vec(), our_checksum)); } Ok(content) } diff --git a/crates/util/keyfork-slip10-test-data/Cargo.toml b/crates/util/keyfork-slip10-test-data/Cargo.toml index 9719736..153f04a 100644 --- a/crates/util/keyfork-slip10-test-data/Cargo.toml +++ b/crates/util/keyfork-slip10-test-data/Cargo.toml @@ -4,7 +4,5 @@ version = "0.1.0" edition = "2021" license = "MIT" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -hex = "0.4.3" +smex = { version = "0.1.0", path = "../smex" } diff --git a/crates/util/keyfork-slip10-test-data/src/lib.rs b/crates/util/keyfork-slip10-test-data/src/lib.rs index 1384cc3..3d5047e 100644 --- a/crates/util/keyfork-slip10-test-data/src/lib.rs +++ b/crates/util/keyfork-slip10-test-data/src/lib.rs @@ -31,166 +31,166 @@ pub fn test_data() -> Result>, Box Result>, Box