From 64129703a8510c78cfc6b4e280cef8a40666d5b7 Mon Sep 17 00:00:00 2001 From: Steven Roose Date: Tue, 23 Apr 2019 20:38:28 +0100 Subject: [PATCH] Fix bug in blech32 --- src/blech32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blech32.cpp b/src/blech32.cpp index 8acd4f0a1f..e8a9327e69 100644 --- a/src/blech32.cpp +++ b/src/blech32.cpp @@ -41,7 +41,7 @@ data Cat(data x, const data& y) /** This function will compute what 6 5-bit values to XOR into the last 6 input values, in order to * make the checksum 0. These 6 values are packed together in a single 30-bit integer. The higher * bits correspond to earlier values. */ -uint32_t PolyMod(const data& v) +uint64_t PolyMod(const data& v) { // The input is interpreted as a list of coefficients of a polynomial over F = GF(32), with an // implicit 1 in front. If the input is [v0,v1,v2,v3,v4], that polynomial is v(x) = @@ -136,7 +136,7 @@ data CreateChecksum(const std::string& hrp, const data& values) { data enc = Cat(ExpandHRP(hrp), values); enc.resize(enc.size() + 12); // ELEMENTS: Append 6->12 zeroes - uint32_t mod = PolyMod(enc) ^ 1; // Determine what to XOR into those 6 zeroes. + uint64_t mod = PolyMod(enc) ^ 1; // Determine what to XOR into those 6 zeroes. data ret(12); // ELEMENTS: 6->12 for (size_t i = 0; i < 12; ++i) { // ELEMENTS: 6->12 // Convert the 5-bit groups in mod to checksum values.