improving tests, correcting cipher

This commit is contained in:
El RIDO 2018-09-01 22:22:10 +02:00
parent 0dbbb61d11
commit b97ac08003
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
4 changed files with 11 additions and 20 deletions

View file

@ -764,7 +764,8 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) {
derivedKey,
StrToArr(compress(message)) // compressed plain text to encrypt
)
return btoa(ArrToStr(encrypted));
object.ct = btoa(ArrToStr(encrypted));
return JSON.stringify(object);
};
/**
@ -780,7 +781,7 @@ jQuery.PrivateBin = (function($, sjcl, RawDeflate) {
me.decipher = async function(key, password, data)
{
try {
if (password.length > 0) {
if ((password || '').trim().length > 0) {
key += sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(password));
}
var object = JSON.parse(data),