Commit a9995971 authored by Joel Martin's avatar Joel Martin

include/des.js: trim some fat.

DES is just used once during authentication and is not performance
sensitive so we save some space by generating and/or removing some
lookup tables. Also, shorten some very frequently used variables.

Shaves off about 100 lines.
parent a59f1cd2
This diff is collapsed.
...@@ -313,7 +313,7 @@ init_vars = function() { ...@@ -313,7 +313,7 @@ init_vars = function() {
mouse_arr = []; mouse_arr = [];
// Clear the per connection encoding stats // Clear the per connection encoding stats
for (i=0; i < encodings.length; i+=1) { for (var i=0; i < encodings.length; i+=1) {
encStats[encodings[i][1]][0] = 0; encStats[encodings[i][1]][0] = 0;
} }
}; };
...@@ -602,11 +602,11 @@ function send_string(str) { ...@@ -602,11 +602,11 @@ function send_string(str) {
} }
function genDES(password, challenge) { function genDES(password, challenge) {
var i, passwd = []; var i, passwd = [], des;
for (i=0; i < password.length; i += 1) { for (i=0; i < password.length; i += 1) {
passwd.push(password.charCodeAt(i)); passwd.push(password.charCodeAt(i));
} }
return DES.encrypt(passwd, challenge); return (new DES(passwd)).encrypt(challenge);
} }
function flushClient() { function flushClient() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment