@@ -248,6 +248,15 @@ var inputs = [
248
248
dkLen : 256 ,
249
249
encoding : 'hex' ,
250
250
result : 'c3f182ee2dec846e70a6942fb529985a3a09765ef04c612923b17f18555a37076deb2b9830d69de5492651e4506ae5776d96d40f67aaee37e1777b8ad5c3111432bb3b6f7e1264401879e641aea2bd0a21a124fd5c1ece0891338d2c44ba312e497bd93660fc053a5df35ade0ca48fd0f3c6c0f6143bb3548420a7cbf6ce7c82bc6b56c8e33adbf6fbac9e0ffc4aa9fb9fcd97fd393700b7d8eac55d45d4651bdb1a270c35c8d40a22e1b2429d6521c4c673e4ba7e7f4a9638ec3b1adbc6dcab64e211b5a26df8f274511be41228cd9a4fae3ada5236ebf39dfc6cd1864652a16516fb622502205d9fdbf09dc6fa964b57cc468ee8d98e4a00bf064222dafec8'
251
+ } ,
252
+ {
253
+ password : new Uint8Array ( 65 ) ,
254
+ salt : 'salt' ,
255
+ logN : 1 ,
256
+ r : 1 ,
257
+ dkLen : 32 ,
258
+ encoding : 'binary' ,
259
+ result : [ 236 , 122 , 177 , 168 , 83 , 62 , 253 , 45 , 27 , 145 , 154 , 151 , 66 , 174 , 56 , 101 , 91 , 130 , 207 , 52 , 20 , 52 , 161 , 66 , 241 , 202 , 39 , 120 , 158 , 73 , 124 , 69 ]
251
260
}
252
261
] ;
253
262
@@ -261,6 +270,7 @@ var shortInput = {
261
270
result : [ 109 , 27 , 184 , 120 , 238 , 233 , 206 , 74 , 123 , 119 , 215 , 164 , 65 , 3 , 87 , 77 ]
262
271
} ;
263
272
273
+
264
274
var inputsWithP = [
265
275
{
266
276
password : 'password' ,
@@ -290,7 +300,8 @@ var inputsWithP = [
290
300
291
301
describe ( 'limits test' , function ( ) {
292
302
var v = shortInput ;
293
-
303
+ var v2 = inputs [ 12 ] ;
304
+
294
305
it ( 'should throw with too small logN' , function ( ) {
295
306
assert . throws ( function ( ) {
296
307
scrypt ( v . password , v . salt , 0 , v . r , v . dkLen ) ;
@@ -305,19 +316,19 @@ describe('limits test', function() {
305
316
306
317
it ( 'should throw with too big N' , function ( ) {
307
318
assert . throws ( function ( ) {
308
- scrypt ( v . password , v . salt , { N : ( ( - 1 ) >>> 0 ) + 1 , r : v . r , dkLen : v . dkLen } ) ;
319
+ scrypt ( v . password , v . salt , { N : ( ( - 1 ) >>> 0 ) + 1 , r : v . r , dkLen : v . dkLen } , function ( ) { } ) ;
309
320
} , Error ) ;
310
321
} ) ;
311
322
312
323
it ( 'should throw with too small N' , function ( ) {
313
324
assert . throws ( function ( ) {
314
- scrypt ( v . password , v . salt , { N : 1 , r : v . r , dkLen : v . dkLen } ) ;
325
+ scrypt ( v . password , v . salt , { N : 1 , r : v . r , dkLen : v . dkLen } , function ( ) { } ) ;
315
326
} , Error ) ;
316
327
} ) ;
317
328
318
329
it ( 'should throw when N is not power of two' , function ( ) {
319
330
assert . throws ( function ( ) {
320
- scrypt ( v . password , v . salt , { N : 123 , r : v . r , dkLen : v . dkLen } ) ;
331
+ scrypt ( v . password , v . salt , { N : 123 , r : v . r , dkLen : v . dkLen } , function ( ) { } ) ;
321
332
} , Error ) ;
322
333
} ) ;
323
334
@@ -339,6 +350,11 @@ describe('limits test', function() {
339
350
} , Error ) ;
340
351
} ) ;
341
352
353
+ it ( 'should not throw when password > 64' , function ( ) {
354
+ assert . doesNotThrow ( function ( ) {
355
+ scrypt ( v2 . password , v2 . salt , { logN : v2 . logN , r : v2 . r , dkLen : v2 . dkLen } , function ( ) { } ) ;
356
+ } , Error ) ;
357
+ } ) ;
342
358
} ) ;
343
359
344
360
describe ( 'argument order test' , function ( ) {
@@ -473,11 +489,18 @@ describe('async input/output test', function() {
473
489
} ) ;
474
490
it ( 'input 9' , function ( done ) {
475
491
async_test ( 9 , step , done ) ;
476
- } ) ;
492
+ } ) ;
493
+ // the following two tests take a bit of time (~2.8s each),
477
494
it ( 'input 10' , function ( done ) {
478
495
async_test ( 10 , step , done ) ;
479
496
} ) ;
480
-
497
+ it ( 'input 11' , function ( done ) {
498
+ async_test ( 11 , step , done ) ;
499
+ } ) ;
500
+ // the following test tests long input
501
+ it ( 'input 12' , function ( done ) {
502
+ async_test ( 12 , step , done ) ;
503
+ } ) ;
481
504
} ) ;
482
505
483
506
describe ( 'async input/output test with zero interruptStep' , function ( ) {
0 commit comments