Comparing version 0.3.8 to 0.3.9
@@ -0,1 +1,6 @@ | ||
## 0.3.9 | ||
* 补充 sm4 解密时的 padding 判断 | ||
## 0.3.8 | ||
@@ -2,0 +7,0 @@ |
{ | ||
"name": "sm-crypto", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"description": "sm-crypto", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -329,4 +329,8 @@ /* eslint-disable no-bitwise, no-mixed-operators, complexity */ | ||
if ((padding === 'pkcs#5' || padding === 'pkcs#7') && cryptFlag === DECRYPT) { | ||
const paddingCount = outArray[outArray.length - 1] | ||
outArray.splice(outArray.length - paddingCount, paddingCount) | ||
const len = outArray.length | ||
const paddingCount = outArray[len - 1] | ||
for (let i = 1; i <= paddingCount; i++) { | ||
if (outArray[len - i] !== paddingCount) throw new Error('padding is invalid') | ||
} | ||
outArray.splice(len - paddingCount, paddingCount) | ||
} | ||
@@ -333,0 +337,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94989
1423