Convert DES into a class

This commit is contained in:
Juanjo Diaz
2019-02-17 00:25:33 +02:00
committed by Lauri Kasanen
parent 7b7295fd4e
commit 075eed5cbb
2 changed files with 71 additions and 77 deletions

View File

@@ -1914,11 +1914,8 @@ export default class RFB extends EventTargetMixin {
}
static genDES(password, challenge) {
const passwd = [];
for (let i = 0; i < password.length; i++) {
passwd.push(password.charCodeAt(i));
}
return (new DES(passwd)).encrypt(challenge);
const passwordChars = password.split('').map(c => c.charCodeAt(0));
return (new DES(passwordChars)).encrypt(challenge);
}
}