nightingale1/vendor/github.com/toolkits/pkg/str/base64.go

17 lines
292 B
Go

package str
import (
"encoding/base64"
)
// base64 encode
func Base64Encode(str string) string {
return base64.StdEncoding.EncodeToString([]byte(str))
}
// base64 decode
func Base64Decode(str string) (string, error) {
s, e := base64.StdEncoding.DecodeString(str)
return string(s), e
}