From e71dcae97af32af00a377df66d12571b988d9d38 Mon Sep 17 00:00:00 2001 From: phoebos Date: Sun, 11 Jul 2021 20:46:42 +0100 Subject: base64: fix algorithm works now! --- base64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base64.c b/base64.c index 760f5ad..b05b57e 100644 --- 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; -- cgit 1.4.1-2-gfad0