kandr

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e71dcae97af32af00a377df66d12571b988d9d38
parent 8890c639a0b3f5e5b3ec6fe74cdaac841f9350c6
Author: phoebos <ben@bvnf.space>
Date:   Sun, 11 Jul 2021 20:46:42 +0100

base64: fix algorithm

works now!

Diffstat:
Mbase64.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/base64.c b/base64.c @@ -68,9 +68,9 @@ char *base64(char *i, ssize_t length, unsigned dflg){ } out[o] = tbl_base64[i[0] >> 2]; ++o; - out[o] = tbl_base64[((i[0] & 3) << 4) + (i1 >> 2)]; + out[o] = tbl_base64[((i[0] & 3) << 4) | (i1 >> 4)]; ++o; - out[o] = tbl_base64[((i1 & 3) << 4) + (i2 >> 2)]; + out[o] = tbl_base64[((i1 & 0xf) << 2) | (i2 >> 6)]; ++o; out[o] = tbl_base64[i2 & 0x3f]; ++o;