-rw-r--r-- | frontend/delta/js/Clipperz/Crypto/PRNG.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/frontend/delta/js/Clipperz/Crypto/PRNG.js b/frontend/delta/js/Clipperz/Crypto/PRNG.js index 7885429..80d972f 100644 --- a/frontend/delta/js/Clipperz/Crypto/PRNG.js +++ b/frontend/delta/js/Clipperz/Crypto/PRNG.js | |||
@@ -289,67 +289,67 @@ Clipperz.Crypto.PRNG.MouseRandomnessSource.prototype = MochiKit.Base.update(new | |||
289 | }); | 289 | }); |
290 | 290 | ||
291 | //***************************************************************************** | 291 | //***************************************************************************** |
292 | 292 | ||
293 | Clipperz.Crypto.PRNG.CryptoRandomRandomnessSource = function(args) { | 293 | Clipperz.Crypto.PRNG.CryptoRandomRandomnessSource = function(args) { |
294 | args = args || {}; | 294 | args = args || {}; |
295 | 295 | ||
296 | this._intervalTime = args.intervalTime || 1000; | 296 | this._intervalTime = args.intervalTime || 1000; |
297 | this._browserCrypto = args.browserCrypto; | 297 | this._browserCrypto = args.browserCrypto; |
298 | 298 | ||
299 | Clipperz.Crypto.PRNG.RandomnessSource.call(this, args); | 299 | Clipperz.Crypto.PRNG.RandomnessSource.call(this, args); |
300 | 300 | ||
301 | this.collectEntropy(); | 301 | this.collectEntropy(); |
302 | return this; | 302 | return this; |
303 | } | 303 | } |
304 | 304 | ||
305 | Clipperz.Crypto.PRNG.CryptoRandomRandomnessSource.prototype = MochiKit.Base.update(new Clipperz.Crypto.PRNG.RandomnessSource, { | 305 | Clipperz.Crypto.PRNG.CryptoRandomRandomnessSource.prototype = MochiKit.Base.update(new Clipperz.Crypto.PRNG.RandomnessSource, { |
306 | 306 | ||
307 | 'intervalTime': function() { | 307 | 'intervalTime': function() { |
308 | return this._intervalTime; | 308 | return this._intervalTime; |
309 | }, | 309 | }, |
310 | 310 | ||
311 | 'browserCrypto': function () { | 311 | 'browserCrypto': function () { |
312 | return this._browserCrypto; | 312 | return this._browserCrypto; |
313 | }, | 313 | }, |
314 | 314 | ||
315 | //------------------------------------------------------------------------- | 315 | //------------------------------------------------------------------------- |
316 | 316 | ||
317 | 'collectEntropy': function() { | 317 | 'collectEntropy': function() { |
318 | varbytesToCollect; | 318 | varbytesToCollect; |
319 | 319 | ||
320 | if (this.boostMode() == true) { | 320 | if (this.boostMode() == true) { |
321 | bytesToCollect = 8; | 321 | bytesToCollect = 64; |
322 | } else { | 322 | } else { |
323 | bytesToCollect = 32; | 323 | bytesToCollect = 8; |
324 | } | 324 | } |
325 | 325 | ||
326 | var randomValuesArray = new Uint8Array(bytesToCollect); | 326 | var randomValuesArray = new Uint8Array(bytesToCollect); |
327 | this.browserCrypto().getRandomValues(randomValuesArray); | 327 | this.browserCrypto().getRandomValues(randomValuesArray); |
328 | for (var i = 0; i < randomValuesArray.length; i++) { | 328 | for (var i = 0; i < randomValuesArray.length; i++) { |
329 | this.updateGeneratorWithValue(randomValuesArray[i]); | 329 | this.updateGeneratorWithValue(randomValuesArray[i]); |
330 | } | 330 | } |
331 | 331 | ||
332 | setTimeout(this.collectEntropy, this.intervalTime()); | 332 | setTimeout(this.collectEntropy, this.intervalTime()); |
333 | }, | 333 | }, |
334 | 334 | ||
335 | //------------------------------------------------------------------------- | 335 | //------------------------------------------------------------------------- |
336 | __syntaxFix__: "syntax fix" | 336 | __syntaxFix__: "syntax fix" |
337 | }); | 337 | }); |
338 | 338 | ||
339 | //############################################################################# | 339 | //############################################################################# |
340 | 340 | ||
341 | Clipperz.Crypto.PRNG.Fortuna = function(args) { | 341 | Clipperz.Crypto.PRNG.Fortuna = function(args) { |
342 | vari,c; | 342 | vari,c; |
343 | 343 | ||
344 | args = args || {}; | 344 | args = args || {}; |
345 | 345 | ||
346 | this._key = args.seed || null; | 346 | this._key = args.seed || null; |
347 | if (this._key == null) { | 347 | if (this._key == null) { |
348 | this._counter = 0; | 348 | this._counter = 0; |
349 | this._key = new Clipperz.ByteArray(); | 349 | this._key = new Clipperz.ByteArray(); |
350 | } else { | 350 | } else { |
351 | this._counter = 1; | 351 | this._counter = 1; |
352 | } | 352 | } |
353 | 353 | ||
354 | this._aesKey = null; | 354 | this._aesKey = null; |
355 | 355 | ||