user111868: 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 ?

user208: 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.

111868: <p>I'm currently working on PSBT and I try to understand all the part of the original implementation.</p>
<p>Dealing with base64 PSBT encoding: it seems that we convert the buffer from a base 8 to a base 6 using the <a href="https://www.github.com/bitcoin/bitcoin/tree/master/src%2Futil%2Fstrencodings.h" rel="nofollow noreferrer">convertBytes</a> function.</p>
<p>Is someone that could explain me the aim of this conversion ?</p>
 208: <p>PSBT uses <a href="https://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">Base64</a> encoding. As every Base64 character has <em>64 = 2<sup>6</sup></em> possibilities, they can store 6 bits of information. The <code>ConvertBits</code> 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.</p>
<p><code>ConvertBits&lt;A,B&gt;</code> is not converting from base-<em>A</em> to base-<em>B</em>; it is converting from base-<em>2<sup>A</sup></em> to base-<em>2<sup>B</sup></em>.</p>
