Displaying 1 result from an estimated 1 matches for "b64encode_internal".
2017 Aug 30
1
non-standard base64 functions in tinc 1.1
...0xff;
+ triplet >>= 2;
+ udst[1] = triplet & 0xff; triplet >>= 8;
+ udst[0] = triplet & 0xff;
return i / 4 * 3 + 2;
} else if((i & 3) == 2) {
+ triplet >>= 4;
udst[0] = triplet & 0xff;
return i / 4 * 3 + 1;
} else {
@@ -109,22 +111,19 @@ static int b64encode_internal(const void *src, char *dst, int length, const char
switch(length % 3) {
case 2:
- triplet = usrc[si] | usrc[si + 1] << 8;
- dst[di] = alphabet[triplet & 63]; triplet >>= 6;
+ triplet = usrc[si + 1] << 2 | usrc[si] << 10;
+ dst[di + 2] = alphabet[triplet &a...