-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
循环加密解密好像会报错 #1
Comments
这里确实是存在着问题,我抽时间修复一下。 |
感谢 @painterQ 帮忙修复此问题,测试用例已补充。 |
dist 中SM2随机出错,加密的数据 别的加密机或解密卡不能解密(自己加自己解没有问题,自己加的数据送到加密机不能解密 出错率 10%左右)一下抓取了一条出错数据: |
var sm2 = require('sm-crypto').sm2;
var sm3 = require('sm-crypto').sm3;
var sm4 = require('sm-crypto').sm4;
var assert = require('assert');
var plainMsg = 'hello world!';
var keypair = sm2.generateKeyPairHex();
console.log('keypair:' + keypair);
var i = 0
for (;;) {
i++;
if (i == 1000) {
i = 0;
}
var encryptData = sm2.doEncrypt(plainMsg, keypair.publicKey);
console.log('encrypt result:' + encryptData);
var decryptData = sm2.doDecrypt(encryptData, keypair.privateKey);
console.log('decrypt result:' + decryptData);
assert.equal(plainMsg == decryptData, true, 'error');
}
The text was updated successfully, but these errors were encountered: