From 4e9ff972ad8f31b1ed3c2a9962ebfba8edd93e4e Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 29 Sep 2022 05:13:12 +1000 Subject: [PATCH] Improve checksum documentation Improve the wording describing the base58 checksum. --- bitcoin/src/util/base58.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bitcoin/src/util/base58.rs b/bitcoin/src/util/base58.rs index 6569ca2a..e6c86e7b 100644 --- a/bitcoin/src/util/base58.rs +++ b/bitcoin/src/util/base58.rs @@ -113,7 +113,7 @@ pub fn encode(data: &[u8]) -> String { /// Encodes `data` as a base58 string including the checksum. /// -/// The checksum is the first 4 256-digits of the object's Bitcoin hash, concatenated onto the end. +/// The checksum is the first four bytes of the sha256d of the data, concatenated onto the end. #[deprecated(since = "0.30.0", note = "Use base58::encode_check() instead")] pub fn check_encode_slice(data: &[u8]) -> String { encode_check(data) @@ -121,7 +121,7 @@ pub fn check_encode_slice(data: &[u8]) -> String { /// Encodes `data` as a base58 string including the checksum. /// -/// The checksum is the first 4 256-digits of the object's Bitcoin hash, concatenated onto the end. +/// The checksum is the first four bytes of the sha256d of the data, concatenated onto the end. pub fn encode_check(data: &[u8]) -> String { let checksum = sha256d::Hash::hash(data); encode_iter( @@ -133,7 +133,7 @@ pub fn encode_check(data: &[u8]) -> String { /// Encodes `data` as base58, including the checksum, into a formatter. /// -/// The checksum is the first 4 256-digits of the object's Bitcoin hash, concatenated onto the end. +/// The checksum is the first four bytes of the sha256d of the data, concatenated onto the end. #[deprecated(since = "0.30.0", note = "Use base58::encode_check_to_fmt() instead")] pub fn check_encode_slice_to_fmt(fmt: &mut fmt::Formatter, data: &[u8]) -> fmt::Result { encode_check_to_fmt(fmt, data) @@ -141,7 +141,7 @@ pub fn check_encode_slice_to_fmt(fmt: &mut fmt::Formatter, data: &[u8]) -> fmt:: /// Encodes a slice as base58, including the checksum, into a formatter. /// -/// The checksum is the first 4 256-digits of the object's Bitcoin hash, concatenated onto the end. +/// The checksum is the first four bytes of the sha256d of the data, concatenated onto the end. pub fn encode_check_to_fmt(fmt: &mut fmt::Formatter, data: &[u8]) -> fmt::Result { let checksum = sha256d::Hash::hash(data); let iter = data.iter()