golang的base64加密解密

import "encoding/base64"

const (
    base64Table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
)

var coder = base64.NewEncoding(base64Table)

//base64加密
func Base64Encode(src []byte) []byte {
    return []byte(coder.EncodeToString(src))
}

//base64解密
func Base64Decode(src []byte) ([]byte, error) {
    return coder.DecodeString(string(src))
}

你可能感兴趣的:(golang的base64加密解密)