Jerry 6 years ago
parent
commit
49ebb30603
1 changed files with 2 additions and 10 deletions
  1. 2 10
      util.go

+ 2 - 10
util.go

@@ -271,11 +271,7 @@ func Int642String(intNum int64) (int64Str string) {
 func PKCS7UnPadding(origData []byte) (bs []byte) {
 	length := len(origData)
 	unpaddingNumber := int(origData[length-1]) //找到Byte数组最后的填充byte 数字
-	if unpaddingNumber <= 7 {
-		bs = origData[:(length - unpaddingNumber)] //只截取返回有效数字内的byte数组
-	} else {
-		bs = origData
-	}
+	bs = origData[:(length - unpaddingNumber)] //只截取返回有效数字内的byte数组
 	return
 }
 
@@ -284,10 +280,6 @@ func PKCS7UnPadding(origData []byte) (bs []byte) {
 func PKCS5UnPadding(origData []byte) (bs []byte) {
 	length := len(origData)
 	unpaddingNumber := int(origData[length-1]) //找到Byte数组最后的填充byte
-	if unpaddingNumber <= 5 {
-		bs = origData[:(length - unpaddingNumber)] //只截取返回有效数字内的byte数组
-	} else {
-		bs = origData
-	}
+	bs = origData[:(length - unpaddingNumber)] //只截取返回有效数字内的byte数组
 	return
 }