@@ -51,13 +51,13 @@ const tests = [
5151 } ,
5252 function compareSync ( done ) {
5353 var salt1 = bcrypt . genSaltSync ( ) ,
54- hash1 = bcrypt . hashSync ( "hello" , salt1 ) ; // $2a $
55- var salt2 = bcrypt . genSaltSync ( ) . replace ( / \$ 2 a \$ / , "$2y$" ) ,
54+ hash1 = bcrypt . hashSync ( "hello" , salt1 ) ; // $2b $
55+ var salt2 = bcrypt . genSaltSync ( ) . replace ( / \$ 2 b \$ / , "$2y$" ) ,
5656 hash2 = bcrypt . hashSync ( "world" , salt2 ) ;
57- var salt3 = bcrypt . genSaltSync ( ) . replace ( / \$ 2 a \$ / , "$2b $" ) ,
57+ var salt3 = bcrypt . genSaltSync ( ) . replace ( / \$ 2 b \$ / , "$2a $" ) ,
5858 hash3 = bcrypt . hashSync ( "hello world" , salt3 ) ;
5959
60- assert . strictEqual ( hash1 . substring ( 0 , 4 ) , "$2a $" ) ;
60+ assert . strictEqual ( hash1 . substring ( 0 , 4 ) , "$2b $" ) ;
6161 assert ( bcrypt . compareSync ( "hello" , hash1 ) ) ;
6262 assert ( ! bcrypt . compareSync ( "hello" , hash2 ) ) ;
6363 assert ( ! bcrypt . compareSync ( "hello" , hash3 ) ) ;
@@ -67,7 +67,7 @@ const tests = [
6767 assert ( ! bcrypt . compareSync ( "world" , hash1 ) ) ;
6868 assert ( ! bcrypt . compareSync ( "world" , hash3 ) ) ;
6969
70- assert . strictEqual ( hash3 . substring ( 0 , 4 ) , "$2b $" ) ;
70+ assert . strictEqual ( hash3 . substring ( 0 , 4 ) , "$2a $" ) ;
7171 assert ( bcrypt . compareSync ( "hello world" , hash3 ) ) ;
7272 assert ( ! bcrypt . compareSync ( "hello world" , hash1 ) ) ;
7373 assert ( ! bcrypt . compareSync ( "hello world" , hash2 ) ) ;
@@ -160,24 +160,24 @@ const tests = [
160160 assert . equal ( hash1 , hash2 ) ;
161161 done ( ) ;
162162 } ,
163- // function compat_roundsOOB(done) {
164- // var salt1 = bcrypt.genSaltSync(0), // $10$ like not set
165- // salt2 = binding.genSaltSync(0);
166- // assert.strictEqual(salt1.substring(0, 7), "$2a $10$");
167- // assert.strictEqual(salt2.substring(0, 7), "$2a $10$");
163+ function compat_roundsOOB ( done ) {
164+ var salt1 = bcrypt . genSaltSync ( 0 ) , // $10$ like not set
165+ salt2 = binding . genSaltSync ( 0 ) ;
166+ assert . strictEqual ( salt1 . substring ( 0 , 7 ) , "$2b $10$" ) ;
167+ assert . strictEqual ( salt2 . substring ( 0 , 7 ) , "$2b $10$" ) ;
168168
169- // salt1 = bcrypt.genSaltSync(3); // $04$ is lower cap
170- // salt2 = bcrypt.genSaltSync(3);
171- // assert.strictEqual(salt1.substring(0, 7), "$2a $04$");
172- // assert.strictEqual(salt2.substring(0, 7), "$2a $04$");
169+ salt1 = bcrypt . genSaltSync ( 3 ) ; // $04$ is lower cap
170+ salt2 = bcrypt . genSaltSync ( 3 ) ;
171+ assert . strictEqual ( salt1 . substring ( 0 , 7 ) , "$2b $04$" ) ;
172+ assert . strictEqual ( salt2 . substring ( 0 , 7 ) , "$2b $04$" ) ;
173173
174- // salt1 = bcrypt.genSaltSync(32); // $31$ is upper cap
175- // salt2 = bcrypt.genSaltSync(32);
176- // assert.strictEqual(salt1.substring(0, 7), "$2a $31$");
177- // assert.strictEqual(salt2.substring(0, 7), "$2a $31$");
174+ salt1 = bcrypt . genSaltSync ( 32 ) ; // $31$ is upper cap
175+ salt2 = bcrypt . genSaltSync ( 32 ) ;
176+ assert . strictEqual ( salt1 . substring ( 0 , 7 ) , "$2b $31$" ) ;
177+ assert . strictEqual ( salt2 . substring ( 0 , 7 ) , "$2b $31$" ) ;
178178
179- // done();
180- // }
179+ done ( ) ;
180+ }
181181]
182182
183183function next ( ) {
0 commit comments