git-subtree-dir: twofactor git-subtree-mainline:4dc135cfe0git-subtree-split:c999bf35b0
17 lines
288 B
Go
17 lines
288 B
Go
package twofactor
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// Pad calculates the number of '='s to add to our encoded string
|
|
// to make base32.StdEncoding.DecodeString happy
|
|
func Pad(s string) string {
|
|
if !strings.HasSuffix(s, "=") && len(s)%8 != 0 {
|
|
for len(s)%8 != 0 {
|
|
s += "="
|
|
}
|
|
}
|
|
return s
|
|
}
|