MCPcopy Create free account
hub / github.com/ElementsProject/elements / descsum_polymod

Function descsum_polymod

test/functional/test_framework/descriptors.py:13–21  ·  view source on GitHub ↗

Internal function that computes the descriptor checksum.

(symbols)

Source from the content-addressed store, hash-verified

11GENERATOR = [0xf5dee51989, 0xa9fdca3312, 0x1bab10e32d, 0x3706b1677a, 0x644d626ffd]
12
13def descsum_polymod(symbols):
14 """Internal function that computes the descriptor checksum."""
15 chk = 1
16 for value in symbols:
17 top = chk >> 35
18 chk = (chk & 0x7ffffffff) << 5 ^ value
19 for i in range(5):
20 chk ^= GENERATOR[i] if ((top >> i) & 1) else 0
21 return chk
22
23def descsum_expand(s):
24 """Internal function that does the character to symbol expansion"""

Callers 2

descsum_createFunction · 0.70
descsum_checkFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected