Skip to content

fix: reject non-integer genSalt costs - #174

Open
official-burak wants to merge 1 commit into
dcodeIO:mainfrom
official-burak:fix/gensalt-integer-rounds
Open

fix: reject non-integer genSalt costs#174
official-burak wants to merge 1 commit into
dcodeIO:mainfrom
official-burak:fix/gensalt-integer-rounds

Conversation

@official-burak

@official-burak official-burak commented Sep 2, 2026

Copy link
Copy Markdown

Thanks for the clear repro. genSaltSync was writing the cost with toString, so a fractional value like 10.5 became $2b$10.5$ and hashSync then failed with Missing salt rounds.

This rejects non-integer costs in genSaltSync, which also covers genSalt and hashSync when they generate a salt. I added a test for the 10.5 case so the salt path stays aligned with the two-digit cost hash already expects.

Fixes #173

Fractional costs were written into the salt with toString, so 10.5
became $2b$10.5$ and hashSync failed with Missing salt rounds.

Fixes dcodeIO#173
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

genSaltSync accepts a non-integer cost and returns a salt that hashSync rejects

1 participant