File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,8 +10,16 @@ if (process.argv.length < 3) {
1010 " |_ _ _ _ |_" ,
1111 " |_)(_| \\/|_)|_ v" + pkg [ 'version' ] + " (c) " + pkg [ 'author' ] ,
1212 " / | "
13- ] . join ( '\n' ) + '\n\n' + " Usage: " + path . basename ( process . argv [ 1 ] ) + " <input> [salt]\n" ) ;
13+ ] . join ( '\n' ) + '\n\n' + " Usage: " + path . basename ( process . argv [ 1 ] ) + " <input> [rounds| salt]\n" ) ;
1414 process . exit ( 1 ) ;
1515} else {
16- process . stdout . write ( bcrypt . hashSync ( process . argv [ 2 ] , process . argv . length > 3 ? process . argv [ 3 ] : bcrypt . genSaltSync ( ) ) + "\n" ) ;
16+ var salt ;
17+ if ( process . argv . length > 3 ) {
18+ salt = process . argv [ 3 ] ;
19+ var rounds = parseInt ( salt , 10 ) ;
20+ if ( rounds == salt )
21+ salt = bcrypt . genSaltSync ( rounds ) ;
22+ } else
23+ salt = bcrypt . genSaltSync ( ) ;
24+ process . stdout . write ( bcrypt . hashSync ( process . argv [ 2 ] , salt ) + "\n" ) ;
1725}
You can’t perform that action at this time.
0 commit comments