You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
344 B
18 lines
344 B
package gobase64
|
|
|
|
import "encoding/base64"
|
|
|
|
// Encode base64编码
|
|
func Encode(input string) string {
|
|
return base64.StdEncoding.EncodeToString([]byte(input))
|
|
}
|
|
|
|
// Decode base64解码
|
|
func Decode(input string) string {
|
|
decodeString, err := base64.StdEncoding.DecodeString(input)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
return string(decodeString)
|
|
}
|