summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/ByteArray.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/ByteArray.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/ByteArray.js71
1 files changed, 16 insertions, 55 deletions
diff --git a/frontend/gamma/js/Clipperz/ByteArray.js b/frontend/gamma/js/Clipperz/ByteArray.js
index ae586e7..22c7c6e 100644
--- a/frontend/gamma/js/Clipperz/ByteArray.js
+++ b/frontend/gamma/js/Clipperz/ByteArray.js
@@ -1,24 +1,22 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer 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*/
@@ -90,9 +88,6 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
90 88
91 'checkByteValue': function(aValue) { 89 'checkByteValue': function(aValue) {
92//Clipperz.log("aValue", aValue.toString(16));
93//Clipperz.log("(aValue & 0xff)", (aValue & 0xff).toString(16));
94
95 if ((aValue & 0xff) != aValue) { 90 if ((aValue & 0xff) != aValue) {
96 MochiKit.Logging.logError("Clipperz.ByteArray.appendByte: the provided value (0x" + aValue.toString(16) + ") is not a byte value."); 91 Clipperz.logError("Clipperz.ByteArray.appendByte: the provided value (0x" + aValue.toString(16) + ") is not a byte value.");
97 throw Clipperz.ByteArray.exception.InvalidValue; 92 throw Clipperz.ByteArray.exception.InvalidValue;
98 } 93 }
@@ -145,6 +140,4 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
145 } 140 }
146 141
147
148 // result = new Clipperz.ByteArray();
149 result = this.newInstance(); 142 result = this.newInstance();
150 c = a.length(); 143 c = a.length();
@@ -157,14 +150,4 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
157 150
158 //------------------------------------------------------------------------- 151 //-------------------------------------------------------------------------
159/*
160 'shiftLeft': function(aNumberOfBitsToShift) {
161 var result;
162
163 result = this.clone(); //???????????
164
165 return result;
166 },
167 */
168 //-------------------------------------------------------------------------
169 152
170 'appendBlock': function(aBlock) { 153 'appendBlock': function(aBlock) {
@@ -293,5 +276,4 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
293 } 276 }
294 result = selectedByte & selectedByteMask ? 1 : 0; 277 result = selectedByte & selectedByteMask ? 1 : 0;
295//console.log("aBitPosition: " + aBitPosition + ", length: " + this.length() + ", bytePosition: " + bytePosition + ", bitPositionInSelectedByte: " + bitPositionInSelectedByte + ", selectedByteMask: " + selectedByteMask);
296 278
297 return result; 279 return result;
@@ -322,7 +304,4 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
322 vari; 304 vari;
323 305
324//var startTime = new Date();
325
326 //# result = "";
327 result = []; 306 result = [];
328 307
@@ -366,12 +345,8 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
366 } 345 }
367 346
368 // result += currentCharacter;
369 result.push(currentCharacter); 347 result.push(currentCharacter);
370 i++; 348 i++;
371 } 349 }
372 350
373//MochiKit.Logging.logDebug("[" + (new Date() - startTime) + "] ByteArray.asString");
374
375 // return result;
376 return result.join(""); 351 return result.join("");
377 }, 352 },
@@ -387,13 +362,4 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
387 'base64map': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 362 'base64map': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
388 'base64mapIndex': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(''), 363 'base64mapIndex': "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(''),
389 //'base64mapInvertedIndex': {
390 // 'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7, 'I': 8, 'J': 9,
391 // 'K': 10, 'L': 11, 'M': 12, 'N': 13, 'O': 14, 'P': 15, 'Q': 16, 'R': 17, 'S': 18, 'T': 19,
392 // 'U': 20, 'V': 21, 'W': 22, 'X': 23, 'Y': 24, 'Z': 25, 'a': 26, 'b': 27, 'c': 28, 'd': 29,
393 // 'e': 30, 'f': 31, 'g': 32, 'h': 33, 'i': 34, 'j': 35, 'k': 36, 'l': 37, 'm': 38, 'n': 39,
394 // 'o': 40, 'p': 41, 'q': 42, 'r': 43, 's': 44, 't': 45, 'u': 46, 'v': 47, 'w': 48, 'x': 49,
395 // 'y': 50, 'z': 51, '0': 52, '1': 53, '2': 54, '3': 55, '4': 56, '5': 57, '6': 58, '7': 59,
396 // '8': 60, '9': 61, '+': 62, '/': 63,
397 // "=": -1},
398 364
399 //------------------------------------------------------------------------- 365 //-------------------------------------------------------------------------
@@ -406,5 +372,5 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
406 372
407 if ((length % 4) != 0) { 373 if ((length % 4) != 0) {
408 MochiKit.Logging.logError("the value passed to the 'ByteArray.setBase64Value' is not correct"); 374 Clipperz.logError("the value passed to the 'ByteArray.setBase64Value' is not correct");
409 throw Clipperz.ByteArray.exception.InvalidValue; 375 throw Clipperz.ByteArray.exception.InvalidValue;
410 } 376 }
@@ -420,9 +386,4 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
420 value4 = this.base64map.indexOf(aValue.charAt(i+3)); 386 value4 = this.base64map.indexOf(aValue.charAt(i+3));
421 387
422 // value1 = this.base64mapInvertedIndex[aValue.charAt(i)];
423 // value2 = this.base64mapInvertedIndex[aValue.charAt(i+1)];
424 // value3 = this.base64mapInvertedIndex[aValue.charAt(i+2)];
425 // value4 = this.base64mapInvertedIndex[aValue.charAt(i+3)];
426
427 byte1 = (value1 << 2) | ((value2 & 0x30) >> 4); 388 byte1 = (value1 << 2) | ((value2 & 0x30) >> 4);
428 if (value3 != -1) { 389 if (value3 != -1) {
@@ -521,5 +482,5 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, {
521 482
522 if ((length % 8) != 0) { 483 if ((length % 8) != 0) {
523 MochiKit.Logging.logError("the value passed to the 'ByteArray.setBase32Value' is not correct"); 484 Clipperz.logError("the value passed to the 'ByteArray.setBase32Value' is not correct");
524 throw Clipperz.ByteArray.exception.InvalidValue; 485 throw Clipperz.ByteArray.exception.InvalidValue;
525 } 486 }
@@ -729,5 +690,5 @@ Clipperz.ByteArray_hex = function (args) {
729 } 690 }
730 } else { 691 } else {
731MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); 692Clipperz.logError("Clipperz.ByteArray should be inizialized with an hex string.");
732 throw Clipperz.ByteArray.exception.InvalidValue; 693 throw Clipperz.ByteArray.exception.InvalidValue;
733 } 694 }
@@ -915,5 +876,5 @@ Clipperz.ByteArray_array = function (args) {
915 } 876 }
916 } else { 877 } else {
917MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); 878 Clipperz.logError("Clipperz.ByteArray should be inizialized with an hex string.");
918 throw Clipperz.ByteArray.exception.InvalidValue; 879 throw Clipperz.ByteArray.exception.InvalidValue;
919 } 880 }
@@ -1116,5 +1077,5 @@ Clipperz.ByteArray_string = function (args) {
1116 } 1077 }
1117 } else { 1078 } else {
1118MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); 1079Clipperz.logError("Clipperz.ByteArray should be inizialized with an hex string.");
1119 throw Clipperz.ByteArray.exception.InvalidValue; 1080 throw Clipperz.ByteArray.exception.InvalidValue;
1120 } 1081 }