fix(des):修复DES加密时出现的密文字节数组长度不足的情况。

This commit is contained in:
徐涛 committed 2023-07-15 11:56:27 +08:00
1 parent 5e284f320d
commit 185f1f3195
2 files changed
+4 -1

No files matched your search

+1 -1
View File
@@ -41,8 +41,8 @@ func Encrypt(data []byte, key []byte, padding encryption.PaddingMode, keyGenerat
}
iv := keyBytes[:]
cipherText := make([]byte, len(data))
plainText := encryption.Padding(data, block.BlockSize(), padding)
cipherText := make([]byte, len(plainText))
mode := cipher.NewCBCEncrypter(block, iv)
mode.CryptBlocks(cipherText, plainText)