Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
8d8fa1d1
Commit
8d8fa1d1
authored
12 years ago
by
Zachary Carter
Browse files
Options
Downloads
Patches
Plain Diff
add test for bcrypt compatibility with old version
parent
07d25614
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/bcrypt-compatibility-test.js
+34
-0
34 additions, 0 deletions
tests/bcrypt-compatibility-test.js
with
34 additions
and
0 deletions
tests/bcrypt-compatibility-test.js
0 → 100644
+
34
−
0
View file @
8d8fa1d1
#!/usr/bin/env node
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require
(
'
./lib/test_env.js
'
);
const
assert
=
require
(
'
assert
'
),
vows
=
require
(
'
vows
'
),
config
=
require
(
'
../lib/configuration.js
'
),
bcrypt
=
require
(
'
bcrypt
'
);
var
suite
=
vows
.
describe
(
'
bcrypt-compatibility
'
);
suite
.
addBatch
({
"
new bcrypt of password for given salt
"
:
{
topic
:
function
()
{
var
salt
=
"
$2a$04$rakQlaS/TyfjZmoVuRs9ku
"
;
bcrypt
.
encrypt
(
"
Thisismypassword1!
"
,
salt
,
this
.
callback
);
},
"
should match old bcrypt
"
:
function
(
hash
)
{
assert
.
strictEqual
(
hash
,
'
$2a$04$rakQlaS/TyfjZmoVuRs9kuQHFk2oShl8DNmVbxgSZyOE8Hzgk0One
'
);
}
},
"
get rounds of old hash should match new bcrypt
"
:
function
()
{
var
hash
=
'
$2a$04$rakQlaS/TyfjZmoVuRs9kuQHFk2oShl8DNmVbxgSZyOE8Hzgk0One
'
;
assert
.
strictEqual
(
4
,
bcrypt
.
getRounds
(
hash
));
}
});
if
(
process
.
argv
[
1
]
===
__filename
)
suite
.
run
();
else
suite
.
export
(
module
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment