I'm currently working on PSBT and I try to understand all the part of the original implementation.

Dealing with base64 PSBT encoding: it seems that we convert the buffer from a base 8 to a base 6 using the convertBytes function.

Is someone that could explain me the aim of this conversion ?


PSBT uses Base64 encoding. As every Base64 character has 64 = 26 possibilities, they can store 6 bits of information. The ConvertBits function you link to takes input bytes (which consist of 8 bits each), and rearranges them into groups of 6 bits, which are then mapped to the Base64 character set.

ConvertBits<A,B> is not converting from base-A to base-B; it is converting from base-2A to base-2B.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.