Skip to content

Commit

Permalink
bip32: bump bs58 to v0.5 (#1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-iqlusion authored May 29, 2023
1 parent c84c5b7 commit 5576320
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 60 deletions.
75 changes: 19 additions & 56 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 bip32/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ edition = "2021"
rust-version = "1.65"

[dependencies]
bs58 = { version = "0.4", default-features = false, features = ["check"] }
bs58 = { version = "0.5", default-features = false, features = ["check"] }
hmac = { version = "0.12", default-features = false }
rand_core = { version = "0.6", default-features = false }
ripemd = { version = "0.1", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions bip32/src/extended_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl ExtendedKey {
bytes[13..45].copy_from_slice(&self.attrs.chain_code);
bytes[45..78].copy_from_slice(&self.key_bytes);

let base58_len = bs58::encode(&bytes).with_check().into(buffer.as_mut())?;
let base58_len = bs58::encode(&bytes).with_check().onto(buffer.as_mut())?;
bytes.zeroize();

str::from_utf8(&buffer[..base58_len]).map_err(|_| Error::Base58)
Expand All @@ -70,7 +70,7 @@ impl FromStr for ExtendedKey {

fn from_str(base58: &str) -> Result<Self> {
let mut bytes = [0u8; Self::BYTE_SIZE + 4]; // with 4-byte checksum
let decoded_len = bs58::decode(base58).with_check(None).into(&mut bytes)?;
let decoded_len = bs58::decode(base58).with_check(None).onto(&mut bytes)?;

if decoded_len != Self::BYTE_SIZE {
return Err(Error::Decode);
Expand Down
2 changes: 1 addition & 1 deletion bip32/src/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl Prefix {
bytes[..4].copy_from_slice(&version.to_be_bytes());

let mut buffer = [0u8; ExtendedKey::MAX_BASE58_SIZE];
bs58::encode(&bytes).with_check().into(buffer.as_mut())?;
bs58::encode(&bytes).with_check().onto(buffer.as_mut())?;

let s = str::from_utf8(&buffer[..4]).map_err(|_| Error::Base58)?;
Self::validate_str(s)?;
Expand Down

0 comments on commit 5576320

Please sign in to comment.