Skip to content
Browse files

Update encrypt/decrypt to work with utf8 json/strings.

  • Loading branch information...
1 parent a2897ab commit 20316892eb8b9309e10c3a0233c2bc8ff8af287f @Mardak Mardak committed Aug 26, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 userData/crypto.js
View
4 userData/crypto.js
@@ -84,15 +84,15 @@ function askPassword() {
exports.encrypt = function(data, onEncrypt) {
exports.ready(function() {
var encrypter = crypto.createCipher("aes256", passwordHash);
- onEncrypt(encrypter.update(data) + encrypter.final());
+ onEncrypt(encrypter.update(data, "utf8") + encrypter.final());
});
};
// Decrypt data with the password hash
exports.decrypt = function(data, onDecrypt) {
exports.ready(function() {
var decrypter = crypto.createDecipher("aes256", passwordHash);
- onDecrypt(decrypter.update(data) + decrypter.final());
+ onDecrypt(decrypter.update(data, null, "utf8") + decrypter.final("utf8"));
});
};

0 comments on commit 2031689

Please sign in to comment.
Something went wrong with that request. Please try again.