Diffstat (limited to 'frontend/gamma/js/Clipperz/Crypto/PRNG.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/Crypto/PRNG.js | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/frontend/gamma/js/Clipperz/Crypto/PRNG.js b/frontend/gamma/js/Clipperz/Crypto/PRNG.js index adfdb16..c539f06 100644 --- a/frontend/gamma/js/Clipperz/Crypto/PRNG.js +++ b/frontend/gamma/js/Clipperz/Crypto/PRNG.js | |||
@@ -1,86 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.ByteArray) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; | 25 | throw "Clipperz.Crypto.PRNG depends on Clipperz.ByteArray!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) { | 28 | try { if (typeof(Clipperz.Crypto.SHA) == 'undefined') { throw ""; }} catch (e) { |
31 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.SHA!"; | 29 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.SHA!"; |
32 | } | 30 | } |
33 | 31 | ||
34 | try { if (typeof(Clipperz.Crypto.AES) == 'undefined') { throw ""; }} catch (e) { | 32 | try { if (typeof(Clipperz.Crypto.AES) == 'undefined') { throw ""; }} catch (e) { |
35 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.AES!"; | 33 | throw "Clipperz.Crypto.PRNG depends on Clipperz.Crypto.AES!"; |
36 | } | 34 | } |
37 | 35 | ||
38 | if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { Clipperz.Crypto.PRNG = {}; } | 36 | if (typeof(Clipperz.Crypto.PRNG) == 'undefined') { Clipperz.Crypto.PRNG = {}; } |
39 | 37 | ||
40 | //############################################################################# | 38 | //############################################################################# |
41 | 39 | ||
42 | Clipperz.Crypto.PRNG.EntropyAccumulator = function(args) { | 40 | Clipperz.Crypto.PRNG.EntropyAccumulator = function(args) { |
43 | args = args || {}; | 41 | args = args || {}; |
44 | //MochiKit.Base.bindMethods(this); | 42 | //MochiKit.Base.bindMethods(this); |
45 | 43 | ||
46 | this._stack = new Clipperz.ByteArray(); | 44 | this._stack = new Clipperz.ByteArray(); |
47 | this._maxStackLengthBeforeHashing = args.maxStackLengthBeforeHashing || 256; | 45 | this._maxStackLengthBeforeHashing = args.maxStackLengthBeforeHashing || 256; |
48 | return this; | 46 | return this; |
49 | } | 47 | } |
50 | 48 | ||
51 | Clipperz.Crypto.PRNG.EntropyAccumulator.prototype = MochiKit.Base.update(null, { | 49 | Clipperz.Crypto.PRNG.EntropyAccumulator.prototype = MochiKit.Base.update(null, { |
52 | 50 | ||
53 | 'toString': function() { | 51 | 'toString': function() { |
54 | return "Clipperz.Crypto.PRNG.EntropyAccumulator"; | 52 | return "Clipperz.Crypto.PRNG.EntropyAccumulator"; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //------------------------------------------------------------------------- | 55 | //------------------------------------------------------------------------- |
58 | 56 | ||
59 | 'stack': function() { | 57 | 'stack': function() { |
60 | return this._stack; | 58 | return this._stack; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | 'setStack': function(aValue) { | 61 | 'setStack': function(aValue) { |
64 | this._stack = aValue; | 62 | this._stack = aValue; |
65 | }, | 63 | }, |
66 | 64 | ||
67 | 'resetStack': function() { | 65 | 'resetStack': function() { |
68 | this.stack().reset(); | 66 | this.stack().reset(); |
69 | }, | 67 | }, |
70 | 68 | ||
71 | 'maxStackLengthBeforeHashing': function() { | 69 | 'maxStackLengthBeforeHashing': function() { |
72 | return this._maxStackLengthBeforeHashing; | 70 | return this._maxStackLengthBeforeHashing; |
73 | }, | 71 | }, |
74 | 72 | ||
75 | //------------------------------------------------------------------------- | 73 | //------------------------------------------------------------------------- |
76 | 74 | ||
77 | 'addRandomByte': function(aValue) { | 75 | 'addRandomByte': function(aValue) { |
78 | this.stack().appendByte(aValue); | 76 | this.stack().appendByte(aValue); |
79 | 77 | ||
80 | if (this.stack().length() > this.maxStackLengthBeforeHashing()) { | 78 | if (this.stack().length() > this.maxStackLengthBeforeHashing()) { |
81 | this.setStack(Clipperz.Crypto.SHA.sha_d256(this.stack())); | 79 | this.setStack(Clipperz.Crypto.SHA.sha_d256(this.stack())); |
82 | } | 80 | } |
83 | }, | 81 | }, |
84 | 82 | ||
85 | //------------------------------------------------------------------------- | 83 | //------------------------------------------------------------------------- |
86 | __syntaxFix__: "syntax fix" | 84 | __syntaxFix__: "syntax fix" |
@@ -428,272 +426,263 @@ Clipperz.Crypto.PRNG.Fortuna.prototype = MochiKit.Base.update(null, { | |||
428 | return this._key; | 426 | return this._key; |
429 | }, | 427 | }, |
430 | 428 | ||
431 | 'setKey': function(aValue) { | 429 | 'setKey': function(aValue) { |
432 | this._key = aValue; | 430 | this._key = aValue; |
433 | this._aesKey = null; | 431 | this._aesKey = null; |
434 | }, | 432 | }, |
435 | 433 | ||
436 | 'aesKey': function() { | 434 | 'aesKey': function() { |
437 | if (this._aesKey == null) { | 435 | if (this._aesKey == null) { |
438 | this._aesKey = new Clipperz.Crypto.AES.Key({key:this.key()}); | 436 | this._aesKey = new Clipperz.Crypto.AES.Key({key:this.key()}); |
439 | } | 437 | } |
440 | 438 | ||
441 | return this._aesKey; | 439 | return this._aesKey; |
442 | }, | 440 | }, |
443 | 441 | ||
444 | 'accumulators': function() { | 442 | 'accumulators': function() { |
445 | return this._accumulators; | 443 | return this._accumulators; |
446 | }, | 444 | }, |
447 | 445 | ||
448 | 'firstPoolReseedLevel': function() { | 446 | 'firstPoolReseedLevel': function() { |
449 | return this._firstPoolReseedLevel; | 447 | return this._firstPoolReseedLevel; |
450 | }, | 448 | }, |
451 | 449 | ||
452 | //------------------------------------------------------------------------- | 450 | //------------------------------------------------------------------------- |
453 | 451 | ||
454 | 'reseedCounter': function() { | 452 | 'reseedCounter': function() { |
455 | return this._reseedCounter; | 453 | return this._reseedCounter; |
456 | }, | 454 | }, |
457 | 455 | ||
458 | 'incrementReseedCounter': function() { | 456 | 'incrementReseedCounter': function() { |
459 | this._reseedCounter = this._reseedCounter +1; | 457 | this._reseedCounter = this._reseedCounter +1; |
460 | }, | 458 | }, |
461 | 459 | ||
462 | //------------------------------------------------------------------------- | 460 | //------------------------------------------------------------------------- |
463 | 461 | ||
464 | 'reseed': function() { | 462 | 'reseed': function() { |
465 | varnewKeySeed; | 463 | varnewKeySeed; |
466 | var reseedCounter; | 464 | var reseedCounter; |
467 | varreseedCounterMask; | 465 | varreseedCounterMask; |
468 | var i, c; | 466 | var i, c; |
469 | 467 | ||
470 | newKeySeed = this.key(); | 468 | newKeySeed = this.key(); |
471 | this.incrementReseedCounter(); | 469 | this.incrementReseedCounter(); |
472 | reseedCounter = this.reseedCounter(); | 470 | reseedCounter = this.reseedCounter(); |
473 | 471 | ||
474 | c = this.numberOfEntropyAccumulators(); | 472 | c = this.numberOfEntropyAccumulators(); |
475 | reseedCounterMask = 0xffffffff >>> (32 - c); | 473 | reseedCounterMask = 0xffffffff >>> (32 - c); |
476 | for (i=0; i<c; i++) { | 474 | for (i=0; i<c; i++) { |
477 | if ((i == 0) || ((reseedCounter & (reseedCounterMask >>> (c - i))) == 0)) { | 475 | if ((i == 0) || ((reseedCounter & (reseedCounterMask >>> (c - i))) == 0)) { |
478 | newKeySeed.appendBlock(this.accumulators()[i].stack()); | 476 | newKeySeed.appendBlock(this.accumulators()[i].stack()); |
479 | this.accumulators()[i].resetStack(); | 477 | this.accumulators()[i].resetStack(); |
480 | } | 478 | } |
481 | } | 479 | } |
482 | 480 | ||
483 | if (reseedCounter == 1) { | 481 | if (reseedCounter == 1) { |
484 | c = this.randomnessSources().length; | 482 | c = this.randomnessSources().length; |
485 | for (i=0; i<c; i++) { | 483 | for (i=0; i<c; i++) { |
486 | this.randomnessSources()[i].setBoostMode(false); | 484 | this.randomnessSources()[i].setBoostMode(false); |
487 | } | 485 | } |
488 | } | 486 | } |
489 | 487 | ||
490 | this.setKey(Clipperz.Crypto.SHA.sha_d256(newKeySeed)); | 488 | this.setKey(Clipperz.Crypto.SHA.sha_d256(newKeySeed)); |
491 | if (reseedCounter == 1) { | 489 | if (reseedCounter == 1) { |
492 | //MochiKit.Logging.logDebug("### PRNG.readyToGenerateRandomBytes"); | ||
493 | Clipperz.log("### PRNG.readyToGenerateRandomBytes"); | 490 | Clipperz.log("### PRNG.readyToGenerateRandomBytes"); |
494 | MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes'); | 491 | MochiKit.Signal.signal(this, 'readyToGenerateRandomBytes'); |
495 | } | 492 | } |
496 | MochiKit.Signal.signal(this, 'reseeded'); | 493 | MochiKit.Signal.signal(this, 'reseeded'); |
497 | }, | 494 | }, |
498 | 495 | ||
499 | //------------------------------------------------------------------------- | 496 | //------------------------------------------------------------------------- |
500 | 497 | ||
501 | 'isReadyToGenerateRandomValues': function() { | 498 | 'isReadyToGenerateRandomValues': function() { |
502 | return this.reseedCounter() != 0; | 499 | return this.reseedCounter() != 0; |
503 | }, | 500 | }, |
504 | 501 | ||
505 | //------------------------------------------------------------------------- | 502 | //------------------------------------------------------------------------- |
506 | 503 | ||
507 | 'entropyLevel': function() { | 504 | 'entropyLevel': function() { |
508 | return this.accumulators()[0].stack().length() + (this.reseedCounter() * this.firstPoolReseedLevel()); | 505 | return this.accumulators()[0].stack().length() + (this.reseedCounter() * this.firstPoolReseedLevel()); |
509 | }, | 506 | }, |
510 | 507 | ||
511 | //------------------------------------------------------------------------- | 508 | //------------------------------------------------------------------------- |
512 | 509 | ||
513 | 'counter': function() { | 510 | 'counter': function() { |
514 | return this._counter; | 511 | return this._counter; |
515 | }, | 512 | }, |
516 | 513 | ||
517 | 'incrementCounter': function() { | 514 | 'incrementCounter': function() { |
518 | this._counter += 1; | 515 | this._counter += 1; |
519 | }, | 516 | }, |
520 | 517 | ||
521 | 'counterBlock': function() { | 518 | 'counterBlock': function() { |
522 | var result; | 519 | var result; |
523 | 520 | ||
524 | result = new Clipperz.ByteArray().appendWords(this.counter(), 0, 0, 0); | 521 | result = new Clipperz.ByteArray().appendWords(this.counter(), 0, 0, 0); |
525 | 522 | ||
526 | return result; | 523 | return result; |
527 | }, | 524 | }, |
528 | 525 | ||
529 | //------------------------------------------------------------------------- | 526 | //------------------------------------------------------------------------- |
530 | 527 | ||
531 | 'getRandomBlock': function() { | 528 | 'getRandomBlock': function() { |
532 | var result; | 529 | var result; |
533 | 530 | ||
534 | result = new Clipperz.ByteArray(Clipperz.Crypto.AES.encryptBlock(this.aesKey(), this.counterBlock().arrayValues())); | 531 | result = new Clipperz.ByteArray(Clipperz.Crypto.AES.encryptBlock(this.aesKey(), this.counterBlock().arrayValues())); |
535 | this.incrementCounter(); | 532 | this.incrementCounter(); |
536 | 533 | ||
537 | return result; | 534 | return result; |
538 | }, | 535 | }, |
539 | 536 | ||
540 | //------------------------------------------------------------------------- | 537 | //------------------------------------------------------------------------- |
541 | 538 | ||
542 | 'getRandomBytes': function(aSize) { | 539 | 'getRandomBytes': function(aSize) { |
543 | var result; | 540 | var result; |
544 | 541 | ||
545 | if (this.isReadyToGenerateRandomValues()) { | 542 | if (this.isReadyToGenerateRandomValues()) { |
546 | var i,c; | 543 | var i,c; |
547 | var newKey; | 544 | var newKey; |
548 | 545 | ||
549 | result = new Clipperz.ByteArray(); | 546 | result = new Clipperz.ByteArray(); |
550 | 547 | ||
551 | c = Math.ceil(aSize / (128 / 8)); | 548 | c = Math.ceil(aSize / (128 / 8)); |
552 | for (i=0; i<c; i++) { | 549 | for (i=0; i<c; i++) { |
553 | result.appendBlock(this.getRandomBlock()); | 550 | result.appendBlock(this.getRandomBlock()); |
554 | } | 551 | } |
555 | 552 | ||
556 | if (result.length() != aSize) { | 553 | if (result.length() != aSize) { |
557 | result = result.split(0, aSize); | 554 | result = result.split(0, aSize); |
558 | } | 555 | } |
559 | 556 | ||
560 | newKey = this.getRandomBlock().appendBlock(this.getRandomBlock()); | 557 | newKey = this.getRandomBlock().appendBlock(this.getRandomBlock()); |
561 | this.setKey(newKey); | 558 | this.setKey(newKey); |
562 | } else { | 559 | } else { |
563 | MochiKit.Logging.logWarning("Fortuna generator has not enough entropy, yet!"); | 560 | Clipperz.logWarning("Fortuna generator has not enough entropy, yet!"); |
564 | throw Clipperz.Crypto.PRNG.exception.NotEnoughEntropy; | 561 | throw Clipperz.Crypto.PRNG.exception.NotEnoughEntropy; |
565 | } | 562 | } |
566 | 563 | ||
567 | return result; | 564 | return result; |
568 | }, | 565 | }, |
569 | 566 | ||
570 | //------------------------------------------------------------------------- | 567 | //------------------------------------------------------------------------- |
571 | 568 | ||
572 | 'addRandomByte': function(aSourceId, aPoolId, aRandomValue) { | 569 | 'addRandomByte': function(aSourceId, aPoolId, aRandomValue) { |
573 | varselectedAccumulator; | 570 | varselectedAccumulator; |
574 | 571 | ||
575 | selectedAccumulator = this.accumulators()[aPoolId]; | 572 | selectedAccumulator = this.accumulators()[aPoolId]; |
576 | selectedAccumulator.addRandomByte(aRandomValue); | 573 | selectedAccumulator.addRandomByte(aRandomValue); |
577 | 574 | ||
578 | if (aPoolId == 0) { | 575 | if (aPoolId == 0) { |
579 | MochiKit.Signal.signal(this, 'addedRandomByte') | 576 | MochiKit.Signal.signal(this, 'addedRandomByte') |
580 | if (selectedAccumulator.stack().length() > this.firstPoolReseedLevel()) { | 577 | if (selectedAccumulator.stack().length() > this.firstPoolReseedLevel()) { |
581 | this.reseed(); | 578 | this.reseed(); |
582 | } | 579 | } |
583 | } | 580 | } |
584 | }, | 581 | }, |
585 | 582 | ||
586 | //------------------------------------------------------------------------- | 583 | //------------------------------------------------------------------------- |
587 | 584 | ||
588 | 'numberOfEntropyAccumulators': function() { | 585 | 'numberOfEntropyAccumulators': function() { |
589 | return this._numberOfEntropyAccumulators; | 586 | return this._numberOfEntropyAccumulators; |
590 | }, | 587 | }, |
591 | 588 | ||
592 | //------------------------------------------------------------------------- | 589 | //------------------------------------------------------------------------- |
593 | 590 | ||
594 | 'randomnessSources': function() { | 591 | 'randomnessSources': function() { |
595 | return this._randomnessSources; | 592 | return this._randomnessSources; |
596 | }, | 593 | }, |
597 | 594 | ||
598 | 'addRandomnessSource': function(aRandomnessSource) { | 595 | 'addRandomnessSource': function(aRandomnessSource) { |
599 | aRandomnessSource.setGenerator(this); | 596 | aRandomnessSource.setGenerator(this); |
600 | aRandomnessSource.setSourceId(this.randomnessSources().length); | 597 | aRandomnessSource.setSourceId(this.randomnessSources().length); |
601 | this.randomnessSources().push(aRandomnessSource); | 598 | this.randomnessSources().push(aRandomnessSource); |
602 | 599 | ||
603 | if (this.isReadyToGenerateRandomValues() == false) { | 600 | if (this.isReadyToGenerateRandomValues() == false) { |
604 | aRandomnessSource.setBoostMode(true); | 601 | aRandomnessSource.setBoostMode(true); |
605 | } | 602 | } |
606 | }, | 603 | }, |
607 | 604 | ||
608 | //------------------------------------------------------------------------- | 605 | //------------------------------------------------------------------------- |
609 | 606 | ||
610 | 'deferredEntropyCollection': function(aValue) { | 607 | 'deferredEntropyCollection': function(aValue) { |
611 | var result; | 608 | var result; |
612 | 609 | ||
613 | //MochiKit.Logging.logDebug(">>> PRNG.deferredEntropyCollection"); | ||
614 | 610 | ||
615 | if (this.isReadyToGenerateRandomValues()) { | 611 | if (this.isReadyToGenerateRandomValues()) { |
616 | //MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 1"); | ||
617 | result = aValue; | 612 | result = aValue; |
618 | } else { | 613 | } else { |
619 | //MochiKit.Logging.logDebug("--- PRNG.deferredEntropyCollection - 2"); | ||
620 | var deferredResult; | 614 | var deferredResult; |
621 | 615 | ||
622 | // Clipperz.NotificationCenter.notify(this, 'updatedProgressState', 'collectingEntropy', true); | ||
623 | |||
624 | deferredResult = new Clipperz.Async.Deferred("PRNG.deferredEntropyCollection"); | 616 | deferredResult = new Clipperz.Async.Deferred("PRNG.deferredEntropyCollection"); |
625 | // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.1 - PRNG.deferredEntropyCollection - 1: " + res); return res;}); | ||
626 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Async.succeed, aValue)); | 617 | deferredResult.addCallback(MochiKit.Base.partial(MochiKit.Async.succeed, aValue)); |
627 | // deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("1.2.2 - PRNG.deferredEntropyCollection - 2: " + res); return res;}); | ||
628 | MochiKit.Signal.connect(this, | 618 | MochiKit.Signal.connect(this, |
629 | 'readyToGenerateRandomBytes', | 619 | 'readyToGenerateRandomBytes', |
630 | deferredResult, | 620 | deferredResult, |
631 | 'callback'); | 621 | 'callback'); |
632 | 622 | ||
633 | result = deferredResult; | 623 | result = deferredResult; |
634 | } | 624 | } |
635 | //MochiKit.Logging.logDebug("<<< PRNG.deferredEntropyCollection - result: " + result); | ||
636 | 625 | ||
637 | return result; | 626 | return result; |
638 | }, | 627 | }, |
639 | 628 | ||
640 | //------------------------------------------------------------------------- | 629 | //------------------------------------------------------------------------- |
641 | 630 | ||
642 | 'fastEntropyAccumulationForTestingPurpose': function() { | 631 | 'fastEntropyAccumulationForTestingPurpose': function() { |
643 | while (! this.isReadyToGenerateRandomValues()) { | 632 | while (! this.isReadyToGenerateRandomValues()) { |
644 | this.addRandomByte(Math.floor(Math.random() * 32), Math.floor(Math.random() * 32), Math.floor(Math.random() * 256)); | 633 | this.addRandomByte(Math.floor(Math.random() * 32), Math.floor(Math.random() * 32), Math.floor(Math.random() * 256)); |
645 | } | 634 | } |
646 | }, | 635 | }, |
647 | 636 | ||
648 | //------------------------------------------------------------------------- | 637 | //------------------------------------------------------------------------- |
649 | 638 | ||
650 | 'dump': function(appendToDoc) { | 639 | 'dump': function(appendToDoc) { |
651 | var tbl; | 640 | var tbl; |
652 | var i,c; | 641 | var i,c; |
653 | 642 | ||
654 | tbl = document.createElement("table"); | 643 | tbl = document.createElement("table"); |
655 | tbl.border = 0; | 644 | tbl.border = 0; |
656 | with (tbl.style) { | 645 | with (tbl.style) { |
657 | border = "1px solid lightgrey"; | 646 | border = "1px solid lightgrey"; |
658 | fontFamily = 'Helvetica, Arial, sans-serif'; | 647 | fontFamily = 'Helvetica, Arial, sans-serif'; |
659 | fontSize = '8pt'; | 648 | fontSize = '8pt'; |
660 | //borderCollapse = "collapse"; | 649 | //borderCollapse = "collapse"; |
661 | } | 650 | } |
662 | var hdr = tbl.createTHead(); | 651 | var hdr = tbl.createTHead(); |
663 | var hdrtr = hdr.insertRow(0); | 652 | var hdrtr = hdr.insertRow(0); |
664 | // document.createElement("tr"); | 653 | // document.createElement("tr"); |
665 | { | 654 | { |
666 | var ntd; | 655 | var ntd; |
667 | 656 | ||
668 | ntd = hdrtr.insertCell(0); | 657 | ntd = hdrtr.insertCell(0); |
669 | ntd.style.borderBottom = "1px solid lightgrey"; | 658 | ntd.style.borderBottom = "1px solid lightgrey"; |
670 | ntd.style.borderRight = "1px solid lightgrey"; | 659 | ntd.style.borderRight = "1px solid lightgrey"; |
671 | ntd.appendChild(document.createTextNode("#")); | 660 | ntd.appendChild(document.createTextNode("#")); |
672 | 661 | ||
673 | ntd = hdrtr.insertCell(1); | 662 | ntd = hdrtr.insertCell(1); |
674 | ntd.style.borderBottom = "1px solid lightgrey"; | 663 | ntd.style.borderBottom = "1px solid lightgrey"; |
675 | ntd.style.borderRight = "1px solid lightgrey"; | 664 | ntd.style.borderRight = "1px solid lightgrey"; |
676 | ntd.appendChild(document.createTextNode("s")); | 665 | ntd.appendChild(document.createTextNode("s")); |
677 | 666 | ||
678 | ntd = hdrtr.insertCell(2); | 667 | ntd = hdrtr.insertCell(2); |
679 | ntd.colSpan = this.firstPoolReseedLevel(); | 668 | ntd.colSpan = this.firstPoolReseedLevel(); |
680 | ntd.style.borderBottom = "1px solid lightgrey"; | 669 | ntd.style.borderBottom = "1px solid lightgrey"; |
681 | ntd.style.borderRight = "1px solid lightgrey"; | 670 | ntd.style.borderRight = "1px solid lightgrey"; |
682 | ntd.appendChild(document.createTextNode("base values")); | 671 | ntd.appendChild(document.createTextNode("base values")); |
683 | 672 | ||
684 | ntd = hdrtr.insertCell(3); | 673 | ntd = hdrtr.insertCell(3); |
685 | ntd.colSpan = 20; | 674 | ntd.colSpan = 20; |
686 | ntd.style.borderBottom = "1px solid lightgrey"; | 675 | ntd.style.borderBottom = "1px solid lightgrey"; |
687 | ntd.appendChild(document.createTextNode("extra values")); | 676 | ntd.appendChild(document.createTextNode("extra values")); |
688 | 677 | ||
689 | } | 678 | } |
690 | 679 | ||
691 | c = this.accumulators().length; | 680 | c = this.accumulators().length; |
692 | for (i=0; i<c ; i++) { | 681 | for (i=0; i<c ; i++) { |
693 | varcurrentAccumulator; | 682 | varcurrentAccumulator; |
694 | var bdytr; | 683 | var bdytr; |
695 | var bdytd; | 684 | var bdytd; |
696 | var ii, cc; | 685 | var ii, cc; |
697 | 686 | ||
698 | currentAccumulator = this.accumulators()[i] | 687 | currentAccumulator = this.accumulators()[i] |
699 | 688 | ||