summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-09-05 16:37:18 -0400
committerrsiddharth <s@ricketyspace.net>2020-09-05 16:39:56 -0400
commit9cbdd560c0d397f02138ef2d28a414d599a0c91d (patch)
treed97adbf855e1ad95cd485f117c9bca644a3768a2
parent08d36c4d61d1a02b3e2de34d6b56aef03b0cba94 (diff)
lib: add index
* lib/b64.go (index): New function.
-rw-r--r--lib/b64.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/b64.go b/lib/b64.go
index bdf26c0..1fb45dd 100644
--- a/lib/b64.go
+++ b/lib/b64.go
@@ -23,6 +23,16 @@ func encode(b uint16) string {
return string(b64_table[b])
}
+// Return the index for a base64 character.
+func index(c byte) uint32 {
+ for i := 0; i < 64; i++ {
+ if c == b64_table[i] {
+ return uint32(i)
+ }
+ }
+ return uint32(0)
+}
+
// Strip space and newline characters from string.
func stripSpaceChars(s string) string {
ss := ""