(_chaincodevector, _chaincode_bits)
| 282 | # Converts a vector of chaincode integers into a json printable characters string. |
| 283 | # By joining the digits to compose a 6 bits integer and the converting that integer in base64 character. |
| 284 | def chainCodeBase64Encoder(_chaincodevector, _chaincode_bits): |
| 285 | # Add odd number in the vector for codification |
| 286 | num_digits = int(6 / _chaincode_bits) |
| 287 | _outputstring = "" |
| 288 | rest = len(_chaincodevector) % num_digits |
| 289 | if rest != 0: |
| 290 | vectrest = int(num_digits - rest) |
| 291 | for i in range(0, vectrest): |
| 292 | _chaincodevector.append(0) |
| 293 | else: |
| 294 | vectrest = 0 |
| 295 | for i in range(0, len(_chaincodevector), num_digits): |
| 296 | byte = 0 |
| 297 | for j in range(0, num_digits): |
| 298 | byte += _chaincodevector[i + j] << (num_digits - 1 - j) * _chaincode_bits |
| 299 | _outputstring += base64Encoder(byte) |
| 300 | return _outputstring, vectrest |
| 301 | |
| 302 | |
| 303 | # Converts back the json printable characters string to a vector of chaincode integers. |
nothing calls this directly
no test coverage detected