github.com/sereiner/library@v0.0.0-20200518095232-1fa3e640cc5f/security/des/des_test.go (about) 1 package des 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/sereiner/library/ut" 8 ) 9 10 func TestEncrypt(t *testing.T) { 11 input := []byte("hello") 12 key := "12345678" 13 iv := []byte("87654321") 14 crypted, err := EncryptBytes(input, key, iv, "cbc/pkcs5") 15 ut.Expect(t, err, nil) 16 17 o, err := DecryptBytes(crypted, key, iv, "cbc/pkcs5") 18 ut.Expect(t, err, nil) 19 ut.Expect(t, string(o), string(input)) 20 21 pk := []byte("encrypt:ecb/pkcs7") 22 fmt.Println(len(pk)) 23 }