Browse Source

change key_size to 128bits on message encryption

activeAddress
Ivan Socolsky 10 years ago
parent
commit
90bb3e8b18
  1. 6
      lib/walletutils.js

6
lib/walletutils.js

@ -84,9 +84,9 @@ WalletUtils.fromSecret = function(secret) {
WalletUtils.encryptMessage = function(message, privKey) {
var hash = sjcl.hash.sha256.hash(privKey);
var key = sjcl.codec.utf8String.toBits(hash);
key = sjcl.bitArray.clamp(key, 256);
key = sjcl.bitArray.clamp(key, 128);
return sjcl.encrypt(key, message, {
ks: 256,
ks: 128,
iter: 1
});
};
@ -94,7 +94,7 @@ WalletUtils.encryptMessage = function(message, privKey) {
WalletUtils.decryptMessage = function(cyphertextJson, privKey) {
var hash = sjcl.hash.sha256.hash(privKey);
var key = sjcl.codec.utf8String.toBits(hash);
key = sjcl.bitArray.clamp(key, 256);
key = sjcl.bitArray.clamp(key, 128);
return sjcl.decrypt(key, cyphertextJson);
};

Loading…
Cancel
Save