移除一些debug日志打印
This commit is contained in:
parent
802308ebf4
commit
d241281d8a
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ build
|
||||
dist
|
||||
.DS_Store
|
||||
yarn-error.log
|
||||
.vscode
|
@ -1,5 +1,5 @@
|
||||
diff --git a/node_modules/web3-eth-accounts/lib/index.js b/node_modules/web3-eth-accounts/lib/index.js
|
||||
index a176dd9..de56ed8 100644
|
||||
index a176dd9..1a26ff6 100644
|
||||
--- a/node_modules/web3-eth-accounts/lib/index.js
|
||||
+++ b/node_modules/web3-eth-accounts/lib/index.js
|
||||
@@ -23,7 +23,7 @@
|
||||
@ -11,40 +11,33 @@ index a176dd9..de56ed8 100644
|
||||
var scrypt = require('scrypt-js');
|
||||
var uuid = require('uuid');
|
||||
var utils = require('web3-utils');
|
||||
@@ -420,7 +420,14 @@ Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) {
|
||||
@@ -420,7 +420,11 @@ Accounts.prototype.decrypt = function (v3Keystore, password, nonStrict) {
|
||||
if (json.crypto.kdf === 'scrypt') {
|
||||
kdfparams = json.crypto.kdfparams;
|
||||
// FIXME: support progress reporting callback
|
||||
- derivedKey = scrypt.syncScrypt(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
|
||||
+ var start = Date.now();
|
||||
+
|
||||
+ if (window.jsb && window.jsb.jcCryptoScrypt) {
|
||||
+ derivedKey = jsb.jcCryptoScrypt(password, kdfparams.salt, kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
|
||||
+ } else {
|
||||
+ derivedKey = scrypt.syncScrypt(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
|
||||
+ }
|
||||
+ console.log('scrypt encrypt cost time: ' + (Date.now() - start)/1000);
|
||||
}
|
||||
else if (json.crypto.kdf === 'pbkdf2') {
|
||||
kdfparams = json.crypto.kdfparams;
|
||||
@@ -463,7 +470,15 @@ Accounts.prototype.encrypt = function (privateKey, password, options) {
|
||||
@@ -463,7 +467,11 @@ Accounts.prototype.encrypt = function (privateKey, password, options) {
|
||||
kdfparams.n = options.n || 8192; // 2048 4096 8192 16384
|
||||
kdfparams.r = options.r || 8;
|
||||
kdfparams.p = options.p || 1;
|
||||
- derivedKey = scrypt.syncScrypt(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
|
||||
+ var start = Date.now();
|
||||
+
|
||||
+ if (window.jsb && window.jsb.jcCryptoScrypt) {
|
||||
+ derivedKey = jsb.jcCryptoScrypt(password, kdfparams.salt, kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
|
||||
+ } else {
|
||||
+ derivedKey = scrypt.syncScrypt(Buffer.from(password), Buffer.from(kdfparams.salt, 'hex'), kdfparams.n, kdfparams.r, kdfparams.p, kdfparams.dklen);
|
||||
+ }
|
||||
+
|
||||
+ console.log('scrypt encrypt cost time: ' + (Date.now() - start)/1000);
|
||||
}
|
||||
else {
|
||||
throw new Error('Unsupported kdf');
|
||||
@@ -621,6 +636,9 @@ if (!storageAvailable('localStorage')) {
|
||||
@@ -621,6 +629,9 @@ if (!storageAvailable('localStorage')) {
|
||||
*/
|
||||
function storageAvailable(type) {
|
||||
var storage;
|
||||
|
Loading…
x
Reference in New Issue
Block a user