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

Function descsum_expand

test/functional/test_framework/descriptors.py:23–40  ·  view source on GitHub ↗

Internal function that does the character to symbol expansion

(s)

Source from the content-addressed store, hash-verified

21 return chk
22
23def descsum_expand(s):
24 """Internal function that does the character to symbol expansion"""
25 groups = []
26 symbols = []
27 for c in s:
28 if not c in INPUT_CHARSET:
29 return None
30 v = INPUT_CHARSET.find(c)
31 symbols.append(v & 31)
32 groups.append(v >> 5)
33 if len(groups) == 3:
34 symbols.append(groups[0] * 9 + groups[1] * 3 + groups[2])
35 groups = []
36 if len(groups) == 1:
37 symbols.append(groups[0])
38 elif len(groups) == 2:
39 symbols.append(groups[0] * 3 + groups[1])
40 return symbols
41
42def descsum_create(s):
43 """Add a checksum to a descriptor without"""

Callers 2

descsum_createFunction · 0.70
descsum_checkFunction · 0.70

Calls 1

findMethod · 0.80

Tested by

no test coverage detected