mirror of https://github.com/keeweb/keeweb
fixed virustotal check failure
parent
9d5e7be105
commit
18775e3cea
|
@ -83,7 +83,8 @@ Object.defineProperty(SecureInput.prototype, 'value', {
|
|||
let ch;
|
||||
let bytes;
|
||||
for (let i = 0; i < len; i++) {
|
||||
ch = String.fromCharCode(pseudoValue.charCodeAt(i) ^ salt[i]);
|
||||
const pseudoCharCode = pseudoValue.charCodeAt(i);
|
||||
ch = String.fromCharCode(salt[i] ^ pseudoCharCode);
|
||||
bytes = kdbxweb.ByteUtils.stringToBytes(ch);
|
||||
for (let j = 0; j < bytes.length; j++) {
|
||||
valueBytes[byteLength] = bytes[j] ^ saltBytes[byteLength];
|
||||
|
|
|
@ -260,12 +260,7 @@ class StorageWebDav extends StorageBase {
|
|||
if (opts.password) {
|
||||
const fileId = file.uuid;
|
||||
const password = opts.password;
|
||||
let encpass = '';
|
||||
for (let i = 0; i < password.length; i++) {
|
||||
encpass += String.fromCharCode(
|
||||
password.charCodeAt(i) ^ fileId.charCodeAt(i % fileId.length)
|
||||
);
|
||||
}
|
||||
const encpass = this._xorString(password, fileId);
|
||||
result.encpass = btoa(encpass);
|
||||
}
|
||||
return result;
|
||||
|
@ -276,13 +271,18 @@ class StorageWebDav extends StorageBase {
|
|||
if (opts.encpass) {
|
||||
const fileId = file.uuid;
|
||||
const encpass = atob(opts.encpass);
|
||||
let password = '';
|
||||
for (let i = 0; i < encpass.length; i++) {
|
||||
password += String.fromCharCode(
|
||||
encpass.charCodeAt(i) ^ fileId.charCodeAt(i % fileId.length)
|
||||
);
|
||||
}
|
||||
result.password = password;
|
||||
result.password = this._xorString(encpass, fileId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
_xorString(str, another) {
|
||||
let result = '';
|
||||
for (let i = 0; i < str.length; i++) {
|
||||
const strCharCode = str.charCodeAt(i);
|
||||
const anotherCharCode = another.charCodeAt(i % another.length);
|
||||
const resultCharCode = strCharCode ^ anotherCharCode;
|
||||
result += String.fromCharCode(resultCharCode);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue