MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / bech32_polymod

Function bech32_polymod

bitcoin/segwit_addr.py:26–35  ·  view source on GitHub ↗

Internal function that computes the Bech32 checksum.

(values)

Source from the content-addressed store, hash-verified

24
25
26def 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
38def bech32_hrp_expand(hrp):

Callers 2

bech32_verify_checksumFunction · 0.85
bech32_create_checksumFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected