From af2aa3e2df798453338b71f619f2596620a600a5 Mon Sep 17 00:00:00 2001 From: fishpepper Date: Fri, 5 Mar 2021 08:48:54 +0100 Subject: [PATCH] fix bas58 encoding of uint256 with leading zeros --- AddressUtil/Base58.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AddressUtil/Base58.cpp b/AddressUtil/Base58.cpp index 2d80ef35..c01a2bab 100644 --- a/AddressUtil/Base58.cpp +++ b/AddressUtil/Base58.cpp @@ -71,7 +71,8 @@ std::string Base58::toBase58(const secp256k1::uint256 &x) secp256k1::uint256 value = x; - while(!value.isZero()) { + //while(!value.isZero()) { + for(unsigned int i=0; i<=32; i++){ secp256k1::uint256 digit = value.mod(58); int digitInt = digit.toInt32(); @@ -114,4 +115,4 @@ void Base58::getMinMaxFromPrefix(const std::string &prefix, secp256k1::uint256 & minValueOut = minValue; maxValueOut = maxValue; -} \ No newline at end of file +}