diff options
author | rsiddharth <s@ricketyspace.net> | 2020-09-05 16:37:18 -0400 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-09-05 16:39:56 -0400 |
commit | 9cbdd560c0d397f02138ef2d28a414d599a0c91d (patch) | |
tree | d97adbf855e1ad95cd485f117c9bca644a3768a2 | |
parent | 08d36c4d61d1a02b3e2de34d6b56aef03b0cba94 (diff) |
lib: add index
* lib/b64.go (index): New function.
-rw-r--r-- | lib/b64.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 := "" |