From e4a5bff60a0f786b4540d9fad9789ece762094a0 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 21 Mar 2024 10:55:10 +1100 Subject: [PATCH] Upgrade bech32 dependency Upgrade to the newest release of the `bech32` crate. Please note I quickly skimmed bip 380 and briefly thought what the code length should be, but the value used (1023) needs reviewing by a cryptographer - FTR I copied it from `bech32`. --- Cargo.toml | 2 +- src/descriptor/checksum.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1d2a0bfd1..c78a20d0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ rand = ["bitcoin/rand"] base64 = ["bitcoin/base64"] [dependencies] -bech32 = { version = "0.10.0-beta", default-features = false } +bech32 = { version = "0.11.0", default-features = false } bitcoin = { version = "0.31.0", default-features = false } # Do NOT use this as a feature! Use the `serde` feature instead. diff --git a/src/descriptor/checksum.rs b/src/descriptor/checksum.rs index 92bfd3055..4f94f85a1 100644 --- a/src/descriptor/checksum.rs +++ b/src/descriptor/checksum.rs @@ -19,6 +19,7 @@ use crate::prelude::*; use crate::Error; const CHECKSUM_LENGTH: usize = 8; +const CODE_LENGTH: usize = 1023; /// Compute the checksum of a descriptor. /// @@ -142,6 +143,7 @@ const GEN: [u64; 5] = [0xf5dee51989, 0xa9fdca3312, 0x1bab10e32d, 0x3706b1677a, 0 impl Checksum for DescriptorChecksum { type MidstateRepr = u64; // We need 40 bits (8 * 5). const CHECKSUM_LENGTH: usize = CHECKSUM_LENGTH; + const CODE_LENGTH: usize = CODE_LENGTH; const GENERATOR_SH: [u64; 5] = GEN; const TARGET_RESIDUE: u64 = 1; }