package response import ( "encoding/hex" "github.com/tjfoc/gmsm/sm4" ) // Encryption 使用sm4算法加密数据 func Encryption(key string, data []byte) (string, error) { ecbMsg, err := sm4.Sm4Ecb([]byte(key), data, true) if err != nil { return "", err } else { return hex.EncodeToString(ecbMsg), nil } }