Internal function that does the character to symbol expansion
(s)
| 21 | return chk |
| 22 | |
| 23 | def 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 | |
| 42 | def descsum_create(s): |
| 43 | """Add a checksum to a descriptor without""" |
no test coverage detected