summaryrefslogtreecommitdiffstats
path: root/enc/b64.go
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-08-29 13:37:41 -0400
committerrsiddharth <s@ricketyspace.net>2020-08-29 13:37:41 -0400
commit209a14eff23fd2f75b1e82288505b04a0596a110 (patch)
tree6ffc3fd8d77e0c45bb71d7b76b24090f45709adf /enc/b64.go
parent3cc030abc080a79101998afa5df99e7ef5d4a2fd (diff)
rename package enc -> hex
* Makefile (fmt): fmt lib instead of enc * challenge/c01.go: Use lib instead of enc * challenge/c02.go: Use lib instead of enc * enc/b64.go -> lib/b64.go * enc/hex.go -> lib/hex.go * enc/xor.go -> lib/xor.go
Diffstat (limited to 'enc/b64.go')
-rw-r--r--enc/b64.go24
1 files changed, 0 insertions, 24 deletions
diff --git a/enc/b64.go b/enc/b64.go
deleted file mode 100644
index 4c251a2..0000000
--- a/enc/b64.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright © 2020 rsiddharth <s@ricketyspace.net>
-// SPDX-License-Identifier: ISC
-
-package enc
-
-const b64_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
-
-func HexToBase64(hex string) string {
- hb := []byte(hex)
-
- b64 := ""
- for i := 0; i <= len(hb)-3; i = i + 3 {
- a := (HexCharToDec(hb[i])<<8 |
- HexCharToDec(hb[i+1])<<4 |
- HexCharToDec(hb[i+2]))
- b64 += encode(a >> 6)
- b64 += encode(a & 0b111111)
- }
- return b64
-}
-
-func encode(b uint16) string {
- return string(b64_table[b])
-}