|
- 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
- }
|