Diffstat (limited to 'frontend/gamma/js/Clipperz/Crypto/ECC') (more/less context) (ignore whitespace changes)
5 files changed, 61 insertions, 125 deletions
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js index 19f19c2..0d76b9c 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Curve.js | |||
@@ -1,28 +1,26 @@ | |||
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.ECC depends on Clipperz.ByteArray!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
28 | //} | 26 | //} |
@@ -99,28 +97,19 @@ Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | |||
99 | 97 | ||
100 | //----------------------------------------------------------------------------- | 98 | //----------------------------------------------------------------------------- |
101 | 99 | ||
102 | 'add': function(aPointA, aPointB) { | 100 | 'add': function(aPointA, aPointB) { |
103 | var result; | 101 | var result; |
104 | 102 | ||
105 | //console.log(">>> ECC.BinaryField.Curve.add"); | ||
106 | if (aPointA.isZero()) { | 103 | if (aPointA.isZero()) { |
107 | //console.log("--- pointA == zero"); | ||
108 | result = aPointB; | 104 | result = aPointB; |
109 | } else if (aPointB.isZero()) { | 105 | } else if (aPointB.isZero()) { |
110 | //console.log("--- pointB == zero"); | ||
111 | result = aPointA; | 106 | result = aPointA; |
112 | } else if ((aPointA.x().compare(aPointB.x()) == 0) && ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero())) { | 107 | } else if ((aPointA.x().compare(aPointB.x()) == 0) && ((aPointA.y().compare(aPointB.y()) != 0) || aPointB.x().isZero())) { |
113 | //console.log("compare A.x - B.x: ", aPointA.x().compare(aPointB.x())); | ||
114 | //console.log("compare A.y - B.y: ", (aPointA.y().compare(aPointB.y()) != 0)); | ||
115 | //console.log("compare B.x.isZero(): ", aPointB.x().isZero()); | ||
116 | |||
117 | //console.log("--- result = zero"); | ||
118 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); | 108 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); |
119 | } else { | 109 | } else { |
120 | //console.log("--- result = ELSE"); | ||
121 | varf2m; | 110 | varf2m; |
122 | var x, y; | 111 | var x, y; |
123 | var lambda; | 112 | var lambda; |
124 | var aX, aY, bX, bY; | 113 | var aX, aY, bX, bY; |
125 | 114 | ||
126 | aX = aPointA.x()._value; | 115 | aX = aPointA.x()._value; |
@@ -128,41 +117,32 @@ Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | |||
128 | bX = aPointB.x()._value; | 117 | bX = aPointB.x()._value; |
129 | bY = aPointB.y()._value; | 118 | bY = aPointB.y()._value; |
130 | 119 | ||
131 | f2m = this.finiteField(); | 120 | f2m = this.finiteField(); |
132 | 121 | ||
133 | if (aPointA.x().compare(aPointB.x()) != 0) { | 122 | if (aPointA.x().compare(aPointB.x()) != 0) { |
134 | //console.log(" a.x != b.x"); | ||
135 | lambda =f2m._fastMultiply( | 123 | lambda =f2m._fastMultiply( |
136 | f2m._add(aY, bY), | 124 | f2m._add(aY, bY), |
137 | f2m._inverse(f2m._add(aX, bX)) | 125 | f2m._inverse(f2m._add(aX, bX)) |
138 | ); | 126 | ); |
139 | x = f2m._add(this.a()._value, f2m._square(lambda)); | 127 | x = f2m._add(this.a()._value, f2m._square(lambda)); |
140 | f2m._overwriteAdd(x, lambda); | 128 | f2m._overwriteAdd(x, lambda); |
141 | f2m._overwriteAdd(x, aX); | 129 | f2m._overwriteAdd(x, aX); |
142 | f2m._overwriteAdd(x, bX); | 130 | f2m._overwriteAdd(x, bX); |
143 | } else { | 131 | } else { |
144 | //console.log(" a.x == b.x"); | ||
145 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); | 132 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); |
146 | //console.log(" lambda: " + lambda.asString(16)); | ||
147 | x = f2m._add(this.a()._value, f2m._square(lambda)); | 133 | x = f2m._add(this.a()._value, f2m._square(lambda)); |
148 | //console.log(" x (step 1): " + x.asString(16)); | ||
149 | f2m._overwriteAdd(x, lambda); | 134 | f2m._overwriteAdd(x, lambda); |
150 | //console.log(" x (step 2): " + x.asString(16)); | ||
151 | } | 135 | } |
152 | 136 | ||
153 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); | 137 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); |
154 | //console.log(" y (step 1): " + y.asString(16)); | ||
155 | f2m._overwriteAdd(y, x); | 138 | f2m._overwriteAdd(y, x); |
156 | //console.log(" y (step 2): " + y.asString(16)); | ||
157 | f2m._overwriteAdd(y, bY); | 139 | f2m._overwriteAdd(y, bY); |
158 | //console.log(" y (step 3): " + y.asString(16)); | ||
159 | 140 | ||
160 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) | 141 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) |
161 | } | 142 | } |
162 | //console.log("<<< ECC.BinaryField.Curve.add"); | ||
163 | 143 | ||
164 | return result; | 144 | return result; |
165 | }, | 145 | }, |
166 | 146 | ||
167 | //----------------------------------------------------------------------------- | 147 | //----------------------------------------------------------------------------- |
168 | 148 | ||
@@ -194,44 +174,35 @@ Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | |||
194 | bX = aPointB.x()._value; | 174 | bX = aPointB.x()._value; |
195 | bY = aPointB.y()._value; | 175 | bY = aPointB.y()._value; |
196 | 176 | ||
197 | f2m = this.finiteField(); | 177 | f2m = this.finiteField(); |
198 | 178 | ||
199 | if (aPointA.x().compare(aPointB.x()) != 0) { | 179 | if (aPointA.x().compare(aPointB.x()) != 0) { |
200 | //console.log(" a.x != b.x"); | ||
201 | lambda =f2m._fastMultiply( | 180 | lambda =f2m._fastMultiply( |
202 | f2m._add(aY, bY), | 181 | f2m._add(aY, bY), |
203 | f2m._inverse(f2m._add(aX, bX)) | 182 | f2m._inverse(f2m._add(aX, bX)) |
204 | ); | 183 | ); |
205 | x = f2m._add(this.a()._value, f2m._square(lambda)); | 184 | x = f2m._add(this.a()._value, f2m._square(lambda)); |
206 | f2m._overwriteAdd(x, lambda); | 185 | f2m._overwriteAdd(x, lambda); |
207 | f2m._overwriteAdd(x, aX); | 186 | f2m._overwriteAdd(x, aX); |
208 | f2m._overwriteAdd(x, bX); | 187 | f2m._overwriteAdd(x, bX); |
209 | } else { | 188 | } else { |
210 | //console.log(" a.x == b.x"); | ||
211 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); | 189 | lambda = f2m._add(bX, f2m._fastMultiply(bY, f2m._inverse(bX))); |
212 | //console.log(" lambda: " + lambda.asString(16)); | ||
213 | x = f2m._add(this.a()._value, f2m._square(lambda)); | 190 | x = f2m._add(this.a()._value, f2m._square(lambda)); |
214 | //console.log(" x (step 1): " + x.asString(16)); | ||
215 | f2m._overwriteAdd(x, lambda); | 191 | f2m._overwriteAdd(x, lambda); |
216 | //console.log(" x (step 2): " + x.asString(16)); | ||
217 | } | 192 | } |
218 | 193 | ||
219 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); | 194 | y = f2m._fastMultiply(f2m._add(bX, x), lambda); |
220 | //console.log(" y (step 1): " + y.asString(16)); | ||
221 | f2m._overwriteAdd(y, x); | 195 | f2m._overwriteAdd(y, x); |
222 | //console.log(" y (step 2): " + y.asString(16)); | ||
223 | f2m._overwriteAdd(y, bY); | 196 | f2m._overwriteAdd(y, bY); |
224 | //console.log(" y (step 3): " + y.asString(16)); | ||
225 | 197 | ||
226 | // result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) | 198 | // result = new Clipperz.Crypto.ECC.BinaryField.Point({x:new Clipperz.Crypto.ECC.BinaryField.Value(x), y:new Clipperz.Crypto.ECC.BinaryField.Value(y)}) |
227 | aPointA._x._value = x; | 199 | aPointA._x._value = x; |
228 | aPointA._y._value = y; | 200 | aPointA._y._value = y; |
229 | 201 | ||
230 | } | 202 | } |
231 | //console.log("<<< ECC.BinaryField.Curve.add"); | ||
232 | 203 | ||
233 | return result; | 204 | return result; |
234 | }, | 205 | }, |
235 | 206 | ||
236 | //----------------------------------------------------------------------------- | 207 | //----------------------------------------------------------------------------- |
237 | 208 | ||
@@ -247,28 +218,26 @@ Clipperz.Crypto.ECC.BinaryField.Curve.prototype = MochiKit.Base.update(null, { | |||
247 | var countIndex; countIndex = 0; | 218 | var countIndex; countIndex = 0; |
248 | 219 | ||
249 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { | 220 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { |
250 | k = aValue; | 221 | k = aValue; |
251 | Q = aPoint; | 222 | Q = aPoint; |
252 | } else { | 223 | } else { |
253 | MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); | 224 | Clipperz.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); |
254 | k = aValue.negate(); | 225 | k = aValue.negate(); |
255 | Q = this.negate(aPoint); | 226 | Q = this.negate(aPoint); |
256 | } | 227 | } |
257 | 228 | ||
258 | //console.log("k: " + k.toString(16)); | ||
259 | //console.log("k.bitSize: " + k.bitSize()); | ||
260 | for (i=k.bitSize()-1; i>=0; i--) { | 229 | for (i=k.bitSize()-1; i>=0; i--) { |
261 | result = this.add(result, result); | 230 | result = this.add(result, result); |
262 | // this.overwriteAdd(result, result); | 231 | // this.overwriteAdd(result, result); |
263 | if (k.isBitSet(i)) { | 232 | if (k.isBitSet(i)) { |
264 | result = this.add(result, Q); | 233 | result = this.add(result, Q); |
265 | // this.overwriteAdd(result, Q); | 234 | // this.overwriteAdd(result, Q); |
266 | } | 235 | } |
267 | 236 | ||
268 | // if (countIndex==100) {console.log("multiply.break"); break;} else countIndex++; | 237 | // if (countIndex==100) {Clipperz.log("multiply.break"); break;} else countIndex++; |
269 | } | 238 | } |
270 | } | 239 | } |
271 | //console.profileEnd(); | 240 | //console.profileEnd(); |
272 | 241 | ||
273 | return result; | 242 | return result; |
274 | }, | 243 | }, |
@@ -276,61 +245,50 @@ MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not w | |||
276 | //----------------------------------------------------------------------------- | 245 | //----------------------------------------------------------------------------- |
277 | 246 | ||
278 | 'deferredMultiply': function(aValue, aPoint) { | 247 | 'deferredMultiply': function(aValue, aPoint) { |
279 | var deferredResult; | 248 | var deferredResult; |
280 | var result; | 249 | var result; |
281 | 250 | ||
282 | MochiKit.Logging.logDebug(">>> deferredMultiply - value: " + aValue + ", point: " + aPoint); | 251 | Clipperz.log(">>> deferredMultiply - value: " + aValue + ", point: " + aPoint); |
283 | //console.profile("ECC.Curve.multiply"); | 252 | //console.profile("ECC.Curve.multiply"); |
284 | deferredResult = new MochiKit.Async.Deferred(); | 253 | deferredResult = new MochiKit.Async.Deferred(); |
285 | //deferredResult.addCallback(function(res) {console.profile("ECC.Curve.deferredMultiply"); return res;} ); | 254 | //deferredResult.addCallback(function(res) {console.profile("ECC.Curve.deferredMultiply"); return res;} ); |
286 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 1: " + res); return res;}); | 255 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("# 1: " + res); return res;}); |
287 | 256 | ||
288 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); | 257 | result = new Clipperz.Crypto.ECC.BinaryField.Point({x:Clipperz.Crypto.ECC.BinaryField.Value.O, y:Clipperz.Crypto.ECC.BinaryField.Value.O}); |
289 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 2: " + res); return res;}); | 258 | //deferredResult.addBoth(function(res) {Clipperz.logDebug("# 2: " + res); return res;}); |
290 | 259 | ||
291 | if (aValue.isZero() == false) { | 260 | if (aValue.isZero() == false) { |
292 | var k, Q; | 261 | var k, Q; |
293 | var i; | 262 | var i; |
294 | var countIndex; countIndex = 0; | 263 | var countIndex; countIndex = 0; |
295 | 264 | ||
296 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { | 265 | if (aValue.compare(Clipperz.Crypto.ECC.BinaryField.Value.O) > 0) { |
297 | k = aValue; | 266 | k = aValue; |
298 | Q = aPoint; | 267 | Q = aPoint; |
299 | } else { | 268 | } else { |
300 | MochiKit.Logging.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); | 269 | Clipperz.logError("The Clipperz.Crypto.ECC.BinaryFields.Value does not work with negative values!!!!"); |
301 | k = aValue.negate(); | 270 | k = aValue.negate(); |
302 | Q = this.negate(aPoint); | 271 | Q = this.negate(aPoint); |
303 | } | 272 | } |
304 | 273 | ||
305 | //console.log("k: " + k.toString(16)); | ||
306 | //console.log("k.bitSize: " + k.bitSize()); | ||
307 | 274 | ||
308 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 3: " + res); return res;}); | ||
309 | for (i=k.bitSize()-1; i>=0; i--) { | 275 | for (i=k.bitSize()-1; i>=0; i--) { |
310 | //MochiKit.Logging.logDebug("====> " + i); | ||
311 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4 > i = " + i + ": " + res); return res;}); | ||
312 | deferredResult.addMethod(this, "addTwice"); | 276 | deferredResult.addMethod(this, "addTwice"); |
313 | //# result = this.add(result, result); | 277 | //# result = this.add(result, result); |
314 | // this.overwriteAdd(result, result); | 278 | // this.overwriteAdd(result, result); |
315 | if (k.isBitSet(i)) { | 279 | if (k.isBitSet(i)) { |
316 | deferredResult.addMethod(this, "add", Q); | 280 | deferredResult.addMethod(this, "add", Q); |
317 | //# result = this.add(result, Q); | 281 | //# result = this.add(result, Q); |
318 | // this.overwriteAdd(result, Q); | 282 | // this.overwriteAdd(result, Q); |
319 | } | 283 | } |
320 | if (i%20 == 0) {deferredResult.addCallback(MochiKit.Async.wait, 0.1);} | 284 | if (i%20 == 0) {deferredResult.addCallback(MochiKit.Async.wait, 0.1);} |
321 | |||
322 | // if (countIndex==100) {console.log("multiply.break"); break;} else countIndex++; | ||
323 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4 < i = " + i + ": " + res); return res;}); | ||
324 | } | 285 | } |
325 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 4: " + res); return res;}); | ||
326 | } | 286 | } |
327 | //#console.profileEnd(); | 287 | //#console.profileEnd(); |
328 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 5: " + res); return res;}); | ||
329 | //deferredResult.addBoth(function(res) {console.profileEnd(); return res;}); | 288 | //deferredResult.addBoth(function(res) {console.profileEnd(); return res;}); |
330 | //deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("# 6: " + res); return res;}); | ||
331 | deferredResult.callback(result); | 289 | deferredResult.callback(result); |
332 | 290 | ||
333 | //# return result; | 291 | //# return result; |
334 | return deferredResult; | 292 | return deferredResult; |
335 | }, | 293 | }, |
336 | 294 | ||
@@ -438,20 +396,18 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
438 | // | 396 | // |
439 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; | 397 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; |
440 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { | 398 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { |
441 | varresult; | 399 | varresult; |
442 | 400 | ||
443 | if (aValue.bitSize() > 1140) { | 401 | if (aValue.bitSize() > 1140) { |
444 | MochiKit.Logging.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); | 402 | Clipperz.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); |
445 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); | 403 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); |
446 | } else { | 404 | } else { |
447 | varC, T; | 405 | varC, T; |
448 | var i; | 406 | var i; |
449 | 407 | ||
450 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
451 | // C = aValue.value().slice(0); | ||
452 | C = aValue._value.slice(0); | 408 | C = aValue._value.slice(0); |
453 | for (i=35; i>=18; i--) { | 409 | for (i=35; i>=18; i--) { |
454 | T = C[i]; | 410 | T = C[i]; |
455 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); | 411 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); |
456 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); | 412 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); |
457 | } | 413 | } |
@@ -461,13 +417,12 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
461 | 417 | ||
462 | for(i=18; i<=35; i++) { | 418 | for(i=18; i<=35; i++) { |
463 | C[i] = 0; | 419 | C[i] = 0; |
464 | } | 420 | } |
465 | 421 | ||
466 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | 422 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); |
467 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
468 | } | 423 | } |
469 | 424 | ||
470 | return result; | 425 | return result; |
471 | }; | 426 | }; |
472 | } | 427 | } |
473 | 428 | ||
@@ -504,19 +459,18 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
504 | //----------------------------------------------------------------------------- | 459 | //----------------------------------------------------------------------------- |
505 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; | 460 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; |
506 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { | 461 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { |
507 | varresult; | 462 | varresult; |
508 | 463 | ||
509 | if (aValue.bitSize() > 564) { | 464 | if (aValue.bitSize() > 564) { |
510 | MochiKit.Logging.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); | 465 | Clipperz.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); |
511 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); | 466 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); |
512 | } else { | 467 | } else { |
513 | varC, T; | 468 | varC, T; |
514 | var i; | 469 | var i; |
515 | 470 | ||
516 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
517 | C = aValue._value.slice(0); | 471 | C = aValue._value.slice(0); |
518 | for (i=17; i>=9; i--) { | 472 | for (i=17; i>=9; i--) { |
519 | T = C[i]; | 473 | T = C[i]; |
520 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); | 474 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); |
521 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); | 475 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); |
522 | } | 476 | } |
@@ -526,13 +480,12 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
526 | 480 | ||
527 | for(i=9; i<=17; i++) { | 481 | for(i=9; i<=17; i++) { |
528 | C[i] = 0; | 482 | C[i] = 0; |
529 | } | 483 | } |
530 | 484 | ||
531 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | 485 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); |
532 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
533 | } | 486 | } |
534 | 487 | ||
535 | return result; | 488 | return result; |
536 | }; | 489 | }; |
537 | } | 490 | } |
538 | 491 | ||
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js index 56f257a..7b7c2c6 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/FiniteField.js | |||
@@ -1,28 +1,26 @@ | |||
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.ECC depends on Clipperz.ByteArray!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
28 | //} | 26 | //} |
@@ -50,13 +48,12 @@ Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(nul | |||
50 | 48 | ||
51 | //----------------------------------------------------------------------------- | 49 | //----------------------------------------------------------------------------- |
52 | 50 | ||
53 | '_module': function(aValue) { | 51 | '_module': function(aValue) { |
54 | varresult; | 52 | varresult; |
55 | var modulusComparison; | 53 | var modulusComparison; |
56 | //console.log(">>> binaryField.finiteField.(standard)module"); | ||
57 | 54 | ||
58 | modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value); | 55 | modulusComparison = Clipperz.Crypto.ECC.BinaryField.Value._compare(aValue, this.modulus()._value); |
59 | 56 | ||
60 | if (modulusComparison < 0) { | 57 | if (modulusComparison < 0) { |
61 | result = aValue; | 58 | result = aValue; |
62 | } else if (modulusComparison == 0) { | 59 | } else if (modulusComparison == 0) { |
@@ -71,14 +68,13 @@ Clipperz.Crypto.ECC.BinaryField.FiniteField.prototype = MochiKit.Base.update(nul | |||
71 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); | 68 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); |
72 | while (resultBitSize >= modulusBitSize) { | 69 | while (resultBitSize >= modulusBitSize) { |
73 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(this.modulus()._value, resultBitSize - modulusBitSize)); | 70 | Clipperz.Crypto.ECC.BinaryField.Value._overwriteXor(result, Clipperz.Crypto.ECC.BinaryField.Value._shiftLeft(this.modulus()._value, resultBitSize - modulusBitSize)); |
74 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); | 71 | resultBitSize = Clipperz.Crypto.ECC.BinaryField.Value._bitSize(result); |
75 | } | 72 | } |
76 | } | 73 | } |
77 | //console.log("<<< binaryField.finiteField.(standard)module"); | 74 | |
78 | |||
79 | return result; | 75 | return result; |
80 | }, | 76 | }, |
81 | 77 | ||
82 | 'module': function(aValue) { | 78 | 'module': function(aValue) { |
83 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._module(aValue._value.slice(0))); | 79 | return new Clipperz.Crypto.ECC.BinaryField.Value(this._module(aValue._value.slice(0))); |
84 | }, | 80 | }, |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js index ffe287b..fef3220 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Point.js | |||
@@ -1,28 +1,26 @@ | |||
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.ECC depends on Clipperz.ByteArray!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
28 | //} | 26 | //} |
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js index b705a20..634772a 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/BinaryField/Value.js | |||
@@ -1,28 +1,26 @@ | |||
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.ECC depends on Clipperz.ByteArray!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.ByteArray!"; |
28 | //} | 26 | //} |
@@ -365,14 +363,12 @@ Clipperz.Crypto.ECC.BinaryField.Value._compare = function(a,b) { | |||
365 | var i,c; | 363 | var i,c; |
366 | 364 | ||
367 | result = MochiKit.Base.compare(a.length, b.length); | 365 | result = MochiKit.Base.compare(a.length, b.length); |
368 | 366 | ||
369 | c = a.length; | 367 | c = a.length; |
370 | for (i=0; (i<c) && (result==0); i++) { | 368 | for (i=0; (i<c) && (result==0); i++) { |
371 | //console.log("compare[" + c + " - " + i + " - 1] " + this.value()[c-i-1] + ", " + aValue.value()[c-i-1]); | ||
372 | // result = MochiKit.Base.compare(this.value()[c-i-1], aValue.value()[c-i-1]); | ||
373 | result = MochiKit.Base.compare(a[c-i-1], b[c-i-1]); | 369 | result = MochiKit.Base.compare(a[c-i-1], b[c-i-1]); |
374 | } | 370 | } |
375 | 371 | ||
376 | return result; | 372 | return result; |
377 | }; | 373 | }; |
378 | 374 | ||
diff --git a/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js b/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js index be197e3..239e264 100644 --- a/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js +++ b/frontend/gamma/js/Clipperz/Crypto/ECC/StandardCurves.js | |||
@@ -1,28 +1,26 @@ | |||
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.Crypto.ECC.BinaryField.Curve) == 'undefined') { throw ""; }} catch (e) { | 24 | //try { if (typeof(Clipperz.Crypto.ECC.BinaryField.Curve) == 'undefined') { throw ""; }} catch (e) { |
27 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.BinaryField.Curve!"; | 25 | //throw "Clipperz.Crypto.ECC depends on Clipperz.Crypto.ECC.BinaryField.Curve!"; |
28 | //} | 26 | //} |
@@ -131,20 +129,18 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
131 | // | 129 | // |
132 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; | 130 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module; |
133 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { | 131 | Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().module = function(aValue) { |
134 | varresult; | 132 | varresult; |
135 | 133 | ||
136 | if (aValue.bitSize() > 1140) { | 134 | if (aValue.bitSize() > 1140) { |
137 | MochiKit.Logging.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); | 135 | Clipperz.logWarning("ECC.StandarCurves.B571.finiteField().module: falling back to default implementation"); |
138 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); | 136 | result = Clipperz.Crypto.ECC.StandardCurves._B571.finiteField().slowModule(aValue); |
139 | } else { | 137 | } else { |
140 | varC, T; | 138 | varC, T; |
141 | var i; | 139 | var i; |
142 | 140 | ||
143 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
144 | // C = aValue.value().slice(0); | ||
145 | C = aValue._value.slice(0); | 141 | C = aValue._value.slice(0); |
146 | for (i=35; i>=18; i--) { | 142 | for (i=35; i>=18; i--) { |
147 | T = C[i]; | 143 | T = C[i]; |
148 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); | 144 | C[i-18] = (((C[i-18] ^ (T<<5) ^ (T<<7) ^ (T<<10) ^ (T<<15)) & 0xffffffff) >>> 0); |
149 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); | 145 | C[i-17] = ((C[i-17] ^ (T>>>27) ^ (T>>>25) ^ (T>>>22) ^ (T>>>17)) >>> 0); |
150 | } | 146 | } |
@@ -154,13 +150,12 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
154 | 150 | ||
155 | for(i=18; i<=35; i++) { | 151 | for(i=18; i<=35; i++) { |
156 | C[i] = 0; | 152 | C[i] = 0; |
157 | } | 153 | } |
158 | 154 | ||
159 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | 155 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); |
160 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
161 | } | 156 | } |
162 | 157 | ||
163 | return result; | 158 | return result; |
164 | }; | 159 | }; |
165 | } | 160 | } |
166 | 161 | ||
@@ -193,19 +188,18 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
193 | //----------------------------------------------------------------------------- | 188 | //----------------------------------------------------------------------------- |
194 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; | 189 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module; |
195 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { | 190 | Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().module = function(aValue) { |
196 | varresult; | 191 | varresult; |
197 | 192 | ||
198 | if (aValue.bitSize() > 564) { | 193 | if (aValue.bitSize() > 564) { |
199 | MochiKit.Logging.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); | 194 | Clipperz.logWarning("ECC.StandarCurves.B283.finiteField().module: falling back to default implementation"); |
200 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); | 195 | result = Clipperz.Crypto.ECC.StandardCurves._B283.finiteField().slowModule(aValue); |
201 | } else { | 196 | } else { |
202 | varC, T; | 197 | varC, T; |
203 | var i; | 198 | var i; |
204 | 199 | ||
205 | //console.log(">>> binaryField.finiteField.(improved)module"); | ||
206 | C = aValue._value.slice(0); | 200 | C = aValue._value.slice(0); |
207 | for (i=17; i>=9; i--) { | 201 | for (i=17; i>=9; i--) { |
208 | T = C[i]; | 202 | T = C[i]; |
209 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); | 203 | C[i-9] = (((C[i-9] ^ (T<<5) ^ (T<<10) ^ (T<<12) ^ (T<<17)) & 0xffffffff) >>> 0); |
210 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); | 204 | C[i-8] = ((C[i-8] ^ (T>>>27) ^ (T>>>22) ^ (T>>>20) ^ (T>>>15)) >>> 0); |
211 | } | 205 | } |
@@ -215,13 +209,12 @@ MochiKit.Base.update(Clipperz.Crypto.ECC.StandardCurves, { | |||
215 | 209 | ||
216 | for(i=9; i<=17; i++) { | 210 | for(i=9; i<=17; i++) { |
217 | C[i] = 0; | 211 | C[i] = 0; |
218 | } | 212 | } |
219 | 213 | ||
220 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); | 214 | result = new Clipperz.Crypto.ECC.BinaryField.Value(C); |
221 | //console.log("<<< binaryField.finiteField.(improved)module"); | ||
222 | } | 215 | } |
223 | 216 | ||
224 | return result; | 217 | return result; |
225 | }; | 218 | }; |
226 | } | 219 | } |
227 | 220 | ||