@@ -51,13 +51,13 @@ const tests = [
51
51
} ,
52
52
function compareSync ( done ) {
53
53
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$" ) ,
56
56
hash2 = bcrypt . hashSync ( "world" , salt2 ) ;
57
- var salt3 = bcrypt . genSaltSync ( ) . replace ( / \$ 2 a \$ / , "$2b $" ) ,
57
+ var salt3 = bcrypt . genSaltSync ( ) . replace ( / \$ 2 b \$ / , "$2a $" ) ,
58
58
hash3 = bcrypt . hashSync ( "hello world" , salt3 ) ;
59
59
60
- assert . strictEqual ( hash1 . substring ( 0 , 4 ) , "$2a $" ) ;
60
+ assert . strictEqual ( hash1 . substring ( 0 , 4 ) , "$2b $" ) ;
61
61
assert ( bcrypt . compareSync ( "hello" , hash1 ) ) ;
62
62
assert ( ! bcrypt . compareSync ( "hello" , hash2 ) ) ;
63
63
assert ( ! bcrypt . compareSync ( "hello" , hash3 ) ) ;
@@ -67,7 +67,7 @@ const tests = [
67
67
assert ( ! bcrypt . compareSync ( "world" , hash1 ) ) ;
68
68
assert ( ! bcrypt . compareSync ( "world" , hash3 ) ) ;
69
69
70
- assert . strictEqual ( hash3 . substring ( 0 , 4 ) , "$2b $" ) ;
70
+ assert . strictEqual ( hash3 . substring ( 0 , 4 ) , "$2a $" ) ;
71
71
assert ( bcrypt . compareSync ( "hello world" , hash3 ) ) ;
72
72
assert ( ! bcrypt . compareSync ( "hello world" , hash1 ) ) ;
73
73
assert ( ! bcrypt . compareSync ( "hello world" , hash2 ) ) ;
@@ -160,24 +160,24 @@ const tests = [
160
160
assert . equal ( hash1 , hash2 ) ;
161
161
done ( ) ;
162
162
} ,
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$" ) ;
168
168
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$" ) ;
173
173
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$" ) ;
178
178
179
- // done();
180
- // }
179
+ done ( ) ;
180
+ }
181
181
]
182
182
183
183
function next ( ) {
0 commit comments