Skip to content

Commit 6412970

Browse files
committed
Fix bug in blech32
1 parent 0de2b05 commit 6412970

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/blech32.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ data Cat(data x, const data& y)
4141
/** This function will compute what 6 5-bit values to XOR into the last 6 input values, in order to
4242
* make the checksum 0. These 6 values are packed together in a single 30-bit integer. The higher
4343
* bits correspond to earlier values. */
44-
uint32_t PolyMod(const data& v)
44+
uint64_t PolyMod(const data& v)
4545
{
4646
// The input is interpreted as a list of coefficients of a polynomial over F = GF(32), with an
4747
// 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)
136136
{
137137
data enc = Cat(ExpandHRP(hrp), values);
138138
enc.resize(enc.size() + 12); // ELEMENTS: Append 6->12 zeroes
139-
uint32_t mod = PolyMod(enc) ^ 1; // Determine what to XOR into those 6 zeroes.
139+
uint64_t mod = PolyMod(enc) ^ 1; // Determine what to XOR into those 6 zeroes.
140140
data ret(12); // ELEMENTS: 6->12
141141
for (size_t i = 0; i < 12; ++i) { // ELEMENTS: 6->12
142142
// Convert the 5-bit groups in mod to checksum values.

0 commit comments

Comments
 (0)