author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/gamma/js/Clipperz/ByteArray.js | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/gamma/js/Clipperz/ByteArray.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/ByteArray.js | 71 |
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,25 +1,23 @@ | |||
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 | ||
@@ -89,11 +87,8 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
89 | //------------------------------------------------------------------------- | 87 | //------------------------------------------------------------------------- |
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 | } |
99 | }, | 94 | }, |
@@ -144,8 +139,6 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
144 | } | 139 | } |
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(); |
151 | for (i=0; i<c; i++) { | 144 | for (i=0; i<c; i++) { |
@@ -156,16 +149,6 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
156 | }, | 149 | }, |
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) { |
171 | throw Clipperz.Base.exception.AbstractMethod; | 154 | throw Clipperz.Base.exception.AbstractMethod; |
@@ -292,7 +275,6 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
292 | selectedByteMask = 1; | 275 | selectedByteMask = 1; |
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; |
298 | }, | 280 | }, |
@@ -321,9 +303,6 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
321 | varlength; | 303 | varlength; |
322 | vari; | 304 | vari; |
323 | 305 | ||
324 | //var startTime = new Date(); | ||
325 | |||
326 | //# result = ""; | ||
327 | result = []; | 306 | result = []; |
328 | 307 | ||
329 | i = 0; | 308 | i = 0; |
@@ -365,14 +344,10 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
365 | currentCharacter = String.fromCharCode(unicode); | 344 | currentCharacter = String.fromCharCode(unicode); |
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 | }, |
378 | 353 | ||
@@ -386,15 +361,6 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
386 | 361 | ||
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 | //------------------------------------------------------------------------- |
400 | 366 | ||
@@ -405,7 +371,7 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
405 | length = aValue.length; | 371 | length = aValue.length; |
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 | } |
411 | 377 | ||
@@ -419,11 +385,6 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
419 | value3 = this.base64map.indexOf(aValue.charAt(i+2)); | 385 | value3 = this.base64map.indexOf(aValue.charAt(i+2)); |
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) { |
429 | byte2 = ((value2 & 0x0f) << 4) | ((value3 & 0x3c) >> 2); | 390 | byte2 = ((value2 & 0x0f) << 4) | ((value3 & 0x3c) >> 2); |
@@ -520,7 +481,7 @@ Clipperz.ByteArray_abstract.prototype = MochiKit.Base.update(null, { | |||
520 | length = value.length; | 481 | length = value.length; |
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 | } |
526 | 487 | ||
@@ -728,7 +689,7 @@ Clipperz.ByteArray_hex = function (args) { | |||
728 | this._value = "0" + value; | 689 | this._value = "0" + value; |
729 | } | 690 | } |
730 | } else { | 691 | } else { |
731 | MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); | 692 | Clipperz.logError("Clipperz.ByteArray should be inizialized with an hex string."); |
732 | throw Clipperz.ByteArray.exception.InvalidValue; | 693 | throw Clipperz.ByteArray.exception.InvalidValue; |
733 | } | 694 | } |
734 | } else { | 695 | } else { |
@@ -914,7 +875,7 @@ Clipperz.ByteArray_array = function (args) { | |||
914 | value = "0" + value; | 875 | value = "0" + value; |
915 | } | 876 | } |
916 | } else { | 877 | } else { |
917 | MochiKit.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 | } |
920 | 881 | ||
@@ -1115,7 +1076,7 @@ Clipperz.ByteArray_string = function (args) { | |||
1115 | value = "0" + value; | 1076 | value = "0" + value; |
1116 | } | 1077 | } |
1117 | } else { | 1078 | } else { |
1118 | MochiKit.Logging.logError("Clipperz.ByteArray should be inizialized with an hex string."); | 1079 | Clipperz.logError("Clipperz.ByteArray should be inizialized with an hex string."); |
1119 | throw Clipperz.ByteArray.exception.InvalidValue; | 1080 | throw Clipperz.ByteArray.exception.InvalidValue; |
1120 | } | 1081 | } |
1121 | } else { | 1082 | } else { |