Internal function that computes the Bech32 checksum.
(values)
| 24 | |
| 25 | |
| 26 | def bech32_polymod(values): |
| 27 | """Internal function that computes the Bech32 checksum.""" |
| 28 | generator = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3] |
| 29 | chk = 1 |
| 30 | for value in values: |
| 31 | top = chk >> 25 |
| 32 | chk = (chk & 0x1ffffff) << 5 ^ value |
| 33 | for i in range(5): |
| 34 | chk ^= generator[i] if ((top >> i) & 1) else 0 |
| 35 | return chk |
| 36 | |
| 37 | |
| 38 | def bech32_hrp_expand(hrp): |
no outgoing calls
no test coverage detected