Skip to content

Remove deprecated third argument to BCrypt::Engine.hash_secret#145

Open
harelsafra wants to merge 1 commit into
aerospike-community:masterfrom
harelsafra:fix-bcrypt-hash-secret-deprecation
Open

Remove deprecated third argument to BCrypt::Engine.hash_secret#145
harelsafra wants to merge 1 commit into
aerospike-community:masterfrom
harelsafra:fix-bcrypt-hash-secret-deprecation

Conversation

@harelsafra

Copy link
Copy Markdown

Fixes #140.

Problem

LoginCommand.hash_password calls:

BCrypt::Engine.hash_secret(password, SALT, :cost => 10)

Since bcrypt 3.1.19, passing a third argument to hash_secret emits:

[DEPRECATION] Passing the third argument to `BCrypt::Engine.hash_secret` is deprecated. Please do not pass the third argument which is currently not used.

The warning fires on every client/cluster initialization (see the stack trace in #140).

Fix

The cost factor is already encoded in the static SALT ($2a$10$... → cost 10), so the explicit :cost => 10 argument is redundant and ignored by bcrypt. This PR removes it.

Verification

The produced hash is byte-for-byte identical with and without the argument:

SALT = "$2a$10$7EqJtq98hPqEX7fNZaFWoO"
BCrypt::Engine.hash_secret("pw", SALT, :cost => 10) == BCrypt::Engine.hash_secret("pw", SALT)
# => true

So authentication behavior is unchanged; only the deprecation warning is silenced.

🤖 Generated with Claude Code

The cost factor (10) is already encoded in the static SALT
('$2a$10$...'), so passing :cost => 10 as the third argument to
hash_secret is redundant and ignored. bcrypt >= 3.1.19 emits a
deprecation warning for this argument:

  [DEPRECATION] Passing the third argument to
  `BCrypt::Engine.hash_secret` is deprecated.

Verified the produced hash is byte-for-byte identical with and
without the argument. Fixes aerospike-community#140.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

Deprecation warning relevant to Bcrypt on aerospike client

1 participant