DesWurstes / Bech32-Csharp

3 stars 3 forks source link

Bug in `verifyChecksum` method #3

Closed AArnott closed 1 year ago

AArnott commented 1 year ago

Per the spec, the checksum is correct when the PolyMod result is 1.

def bech32_verify_checksum(hrp, data):
  return bech32_polymod(bech32_hrp_expand(hrp) + data) == 1

But in your code you equate it to 0:

https://github.com/DesWurstes/Bech32-Csharp/blob/7e3ef04e26934f787c81c103a336373ac9bbf8d8/Bech32-Csharp/Bech32-Csharp.cs#L93