github.com/GuanceCloud/cliutils@v1.1.21/cliutils_test.go (about) 1 // Unless explicitly stated otherwise all files in this repository are licensed 2 // under the MIT License. 3 // This product includes software developed at Guance Cloud (https://www.guance.com/). 4 // Copyright 2021-present Guance, Inc. 5 6 package cliutils 7 8 import ( 9 "encoding/base64" 10 "log" 11 "testing" 12 ) 13 14 func TestEncrypt(t *testing.T) { 15 phrase := []byte("Pa55W0rd") 16 data := []byte("data to be encrypted") 17 18 endata, err := Encrypt(data, phrase) 19 20 log.Printf("[debug] base64(endata): %s, err: %v", base64.StdEncoding.EncodeToString(endata), err) 21 22 deData, err := Decrypt(endata, phrase) 23 log.Printf("[debug] dedata: %s, err: %v", string(deData), err) 24 }