mirror of
https://github.com/wumansgy/goEncrypt.git
synced 2025-09-26 19:51:27 +08:00
fix: when plain_text is empty decrypt error
This commit is contained in:
@@ -30,7 +30,7 @@ func PKCS5Padding(plainText []byte, blockSize int) []byte{
|
||||
func PKCS5UnPadding(plainText []byte)([]byte,error){
|
||||
length := len(plainText)
|
||||
number:= int(plainText[length-1])
|
||||
if number>=length{
|
||||
if number>length{
|
||||
return nil,ErrPaddingSize
|
||||
}
|
||||
return plainText[:length-number],nil
|
||||
|
Reference in New Issue
Block a user