bcrypt: out-of-range rounds (Infinity, -Infinity, negative) pick a different cost than node bcrypt
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
Start in crates/perry-ext-bcrypt/src/lib.rs at rounds_or_default, which every entry point (hash, hashSync, genSalt, genSaltSync) calls before generating a salt. Read how the current clamping turns out-of-range inputs into a cost, then compare with node [email protected]: Infinity and -Infinity should yield cost 4, and -5 should yield cost 31. Done when a salt generated from each input carries the same cost prefix as Node, checked with a test alongside the existing bcrypt tests.
Written by the indexing model from the issue text.
Description
What happens
rounds_or_default in crates/perry-ext-bcrypt/src/lib.rs (shared by hash, hashSync, genSalt, genSaltSync) maps out-of-range cost values differently from node [email protected]:
| rounds | node [email protected] | Perry |
|---|---|---|
Infinity |
cost 4 | cost 10 |
-Infinity |
cost 4 | cost 10 |
-5 |
cost 31 | cost 4 |
Expected
Perry derives the cost the same way node [email protected] does, so a salt generated from these inputs matches Node's cost prefix.
Found while fixing #15152 (PR #15205); measured against node [email protected].
- Dominant language
- Rust
- Stars
- 4.9k
- Forks
- 166
- Avg merge
- 6h 59m
- Merged PRs (30d)
- 955
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PerryTS/perry
-
node:url: url.parse and url.resolve report name parse/resolve instead of Node's urlParse/urlResolveOpenarea:stdlib effort:S impact:low parity type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area:stdlib effort:S impact:low platform:android type:chore
Difficulty 1/5 Under an hour Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
area:tooling-ci effort:S impact:low type:chore
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
area:tooling-ci effort:S impact:low type:chore
Difficulty 2/5 Half a day Newbie friendliness 68/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ubugeeei-prod/vize#13586 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
storytold/photocraft#16565 ·
Maintainers usually reply within 1 day
-
flaky needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
bherbruck/solvecraft#21315 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
undergroundrap/hatchling#624 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day