Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blobby: use base16ct instead of hex #1082

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 34 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion blobby/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ categories = ["no-std"]
edition = "2018"

[dev-dependencies]
hex = "0.4"
base16ct = { version = "0.2", features = ["std"] }
4 changes: 2 additions & 2 deletions blobby/examples/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{env, error::Error, fs::File};
fn encode(reader: impl BufRead, mut writer: impl Write) -> io::Result<usize> {
let mut blobs = Vec::new();
for line in reader.lines() {
let blob = hex::decode(line?.as_str())
let blob = base16ct::mixed::decode_vec(line?.as_str())
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
blobs.push(blob);
}
Expand Down Expand Up @@ -34,7 +34,7 @@ fn decode<R: BufRead, W: Write>(mut reader: R, mut writer: W) -> io::Result<usiz
format!("invalid blobby data: {:?}", e),
)
})?;
writer.write_all(hex::encode(blob).as_bytes())?;
writer.write_all(base16ct::lower::encode_string(blob).as_bytes())?;
writer.write_all(b"\n")?;
}
Ok(res.len())
Expand Down
Loading