Browse Source

fix decrypt-aes

Denmaseno 8 years ago
parent
commit
eb22e6ee42
1 changed files with 1 additions and 0 deletions
  1. 1 0
      crypt-aes.go

+ 1 - 0
crypt-aes.go

@@ -40,6 +40,7 @@ func EncryptAES(key, data []byte) []byte {
 // DecryptAES func
 // DecryptAES func
 func DecryptAES(key, ori []byte) []byte {
 func DecryptAES(key, ori []byte) []byte {
 	ciphertext := make([]byte, len(ori))
 	ciphertext := make([]byte, len(ori))
+	copy(ciphertext, ori)
 	block, err := aes.NewCipher(key)
 	block, err := aes.NewCipher(key)
 	if err != nil {
 	if err != nil {
 		panic(fmt.Errorf("Error creating new block cipher\n%v\n", err))
 		panic(fmt.Errorf("Error creating new block cipher\n%v\n", err))