@@ -453,8 +453,9 @@ test('Custom 64 chars', t => {
453
453
let charSet = entropy . charSet64
454
454
try {
455
455
charSet . use ( 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ9876543210_-' )
456
- let string = entropy . randomStringWithBytes ( 72 , charSet ,
457
- [ 0x9d , 0x99 , 0x4e , 0xa5 , 0xd2 , 0x3f , 0x8c , 0x86 , 0x80 ] )
456
+ let bytes = [ 0x9d , 0x99 , 0x4e , 0xa5 , 0xd2 , 0x3f , 0x8c , 0x86 , 0x80 ]
457
+ let string = entropy . randomString ( 72 , charSet , bytes )
458
+
458
459
t . is ( string , 'NzLoPDi-JiAa' )
459
460
}
460
461
catch ( error ) {
@@ -470,8 +471,7 @@ test('Custom 32 chars', t => {
470
471
let charSet = entropy . charSet32
471
472
try {
472
473
charSet . use ( '2346789BDFGHJMNPQRTbdfghjlmnpqrt' )
473
- let string = entropy . randomStringWithBytes ( 55 , charSet ,
474
- [ 0xd2 , 0xe3 , 0xe9 , 0xda , 0x19 , 0x97 , 0x52 ] )
474
+ let string = entropy . randomString ( 55 , charSet , [ 0xd2 , 0xe3 , 0xe9 , 0xda , 0x19 , 0x97 , 0x52 ] )
475
475
t . is ( string , 'mHRrbgQlTqF' )
476
476
}
477
477
catch ( error ) {
@@ -487,7 +487,7 @@ test('Custom 16 chars', t => {
487
487
let charSet = entropy . charSet16
488
488
try {
489
489
charSet . use ( '0123456789ABCDEF' )
490
- let string = entropy . randomStringWithBytes ( 20 , charSet , [ 0xc7 , 0xc9 , 0x00 ] )
490
+ let string = entropy . randomString ( 20 , charSet , [ 0xc7 , 0xc9 , 0x00 ] )
491
491
t . is ( string , 'C7C90' )
492
492
}
493
493
catch ( error ) {
@@ -503,7 +503,7 @@ test('Custom 8 chars', t => {
503
503
let charSet = entropy . charSet8
504
504
try {
505
505
charSet . use ( 'abcdefgh' )
506
- let string = entropy . randomStringWithBytes ( 30 , charSet , [ 0xc7 , 0xc9 , 0x07 , 0xc9 ] )
506
+ let string = entropy . randomString ( 30 , charSet , [ 0xc7 , 0xc9 , 0x07 , 0xc9 ] )
507
507
t . is ( string , 'gbheeeahgc' )
508
508
}
509
509
catch ( error ) {
@@ -519,7 +519,7 @@ test('Custom 4 chars', t => {
519
519
let charSet = entropy . charSet4
520
520
try {
521
521
charSet . use ( 'atcg' )
522
- let string = entropy . randomStringWithBytes ( 16 , charSet , [ 0x20 , 0xf1 ] )
522
+ let string = entropy . randomString ( 16 , charSet , [ 0x20 , 0xf1 ] )
523
523
t . is ( string , 'acaaggat' )
524
524
}
525
525
catch ( error ) {
@@ -535,7 +535,7 @@ test('Custom 2 chars', t => {
535
535
let charSet = entropy . charSet2
536
536
try {
537
537
charSet . use ( 'HT' )
538
- let string = entropy . randomStringWithBytes ( 16 , charSet , [ 0xe3 , 0xe9 ] )
538
+ let string = entropy . randomString ( 16 , charSet , [ 0xe3 , 0xe9 ] )
539
539
t . is ( string , 'TTTHHHTTTTTHTHHT' )
540
540
}
541
541
catch ( error ) {
0 commit comments