diff options
author | phoebos <ben@bvnf.space> | 2021-07-11 20:46:42 +0100 |
---|---|---|
committer | phoebos <ben@bvnf.space> | 2021-07-11 20:46:42 +0100 |
commit | e71dcae97af32af00a377df66d12571b988d9d38 (patch) | |
tree | 7a5e15622083b60b5a4bd002e8906f887b0bb783 | |
parent | 8890c639a0b3f5e5b3ec6fe74cdaac841f9350c6 (diff) | |
download | kandr-e71dcae97af32af00a377df66d12571b988d9d38.tar.gz |
base64: fix algorithm
works now!
-rw-r--r-- | base64.c | 4 |
1 files 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; |