From c30ebd7eead4df6ef505b71d944eed315325e16f Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 30 Aug 2020 21:35:12 -0400 Subject: lib: update HexToBase64 * lib/b64.go (HexToBase64): Use hex instead of base 2 for the second AND to get the last 6 bits. --- lib/b64.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/b64.go b/lib/b64.go index d37f710..6b98d42 100644 --- a/lib/b64.go +++ b/lib/b64.go @@ -14,7 +14,7 @@ func HexToBase64(hex string) string { HexCharToDec(hb[i+1])<<4 | HexCharToDec(hb[i+2])) b64 += encode(a >> 6) - b64 += encode(a & 0b111111) + b64 += encode(a & 0x3f) } return b64 } -- cgit v1.2.3