summaryrefslogtreecommitdiff
path: root/js/arris.js
diff options
context:
space:
mode:
authoryvesf <yvesf-git@xapek.org>2010-10-20 09:28:59 +0200
committeryvesf <yvesf-git@xapek.org>2010-10-20 09:28:59 +0200
commitd8140e55d88ddc0f1403c6a33acc82195b958cd0 (patch)
treeece729a54a086454cbd8e254e25d46011ddecc74 /js/arris.js
parentf199e5124d1311d40ad9633349463e356edf4e00 (diff)
downloadarris-d8140e55d88ddc0f1403c6a33acc82195b958cd0.tar.gz
arris-d8140e55d88ddc0f1403c6a33acc82195b958cd0.zip
update js version
Diffstat (limited to 'js/arris.js')
-rw-r--r--js/arris.js50
1 files changed, 28 insertions, 22 deletions
diff --git a/js/arris.js b/js/arris.js
index 950ae33..f52e898 100644
--- a/js/arris.js
+++ b/js/arris.js
@@ -1,10 +1,21 @@
-var sys = require("sys");
+/*
+var sys = require("sys")
function log(x) {
-// sys.print("" + x + "\n");
+ sys.print("" + x + "\n");
}
+*/
+
+function calculatePasswordOfDay(date) {
+ if (typeof(log) == "undefined") {
+ var log = function(msg) { }
+ }
+
+ var year = (date.getYear()+1900) % 1000;
+ var month = date.getMonth()+1;
+ var day = date.getDate();
+ var weekday = date.getDay()-1;
-function calculatePasswordOfDay() {
var seedeight = "MPSJKMDH"
var seedten = "MPSJKMDHAI"
@@ -36,13 +47,7 @@ function calculatePasswordOfDay() {
var buffer = []
var buffer6 = []
var bufferResult = []
-
- var year = 2010 % 1000;
- var month = 10;
- var day = 20;
- var weekday = 3-1;
-
-
+
bufferWeekday[0] = sboxWeekday[weekday][0];
bufferWeekday[1] = sboxWeekday[weekday][1];
bufferWeekday[2] = sboxWeekday[weekday][2];
@@ -92,16 +97,16 @@ function calculatePasswordOfDay() {
buffer6[9] = buffer[sbox2[bufferNum][9]]
log("buffer6=" + buffer6)
- bufferResult[0] = ((seedten.charCodeAt(0) + buffer6[0]) % 0x24);
- bufferResult[1] = ((seedten.charCodeAt(1) + buffer6[1]) % 0x24);
- bufferResult[2] = ((seedten.charCodeAt(2) + buffer6[2]) % 0x24);
- bufferResult[3] = ((seedten.charCodeAt(3) + buffer6[3]) % 0x24);
- bufferResult[4] = ((seedten.charCodeAt(4) + buffer6[4]) % 0x24);
- bufferResult[5] = ((seedten.charCodeAt(5) + buffer6[5]) % 0x24);
- bufferResult[6] = ((seedten.charCodeAt(6) + buffer6[6]) % 0x24);
- bufferResult[7] = ((seedten.charCodeAt(7) + buffer6[7]) % 0x24);
- bufferResult[8] = ((seedten.charCodeAt(8) + buffer6[8]) % 0x24);
- bufferResult[9] = ((seedten.charCodeAt(9) + buffer6[9]) % 0x24);
+ bufferResult[0] = (seedten.charCodeAt(0) + buffer6[0]) % 0x24;
+ bufferResult[1] = (seedten.charCodeAt(1) + buffer6[1]) % 0x24;
+ bufferResult[2] = (seedten.charCodeAt(2) + buffer6[2]) % 0x24;
+ bufferResult[3] = (seedten.charCodeAt(3) + buffer6[3]) % 0x24;
+ bufferResult[4] = (seedten.charCodeAt(4) + buffer6[4]) % 0x24;
+ bufferResult[5] = (seedten.charCodeAt(5) + buffer6[5]) % 0x24;
+ bufferResult[6] = (seedten.charCodeAt(6) + buffer6[6]) % 0x24;
+ bufferResult[7] = (seedten.charCodeAt(7) + buffer6[7]) % 0x24;
+ bufferResult[8] = (seedten.charCodeAt(8) + buffer6[8]) % 0x24;
+ bufferResult[9] = (seedten.charCodeAt(9) + buffer6[9]) % 0x24;
log("bufferResult=" + bufferResult)
var out = "";
@@ -111,5 +116,6 @@ function calculatePasswordOfDay() {
return out;
}
-
-sys.print(calculatePasswordOfDay() + "\n")
+/*
+sys.print(calculatePasswordOfDay(new Date()) + "\n")
+*/