Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

BCrypt::Engine.hash_secret method is generating unexpected long hash string on Fedora 28 #165

Copy link
Copy link
@yalcin

Description

@yalcin
Issue body actions

I tried to generate a new password with Password.create('test') but it throws BCrypt::Errors::InvalidHash (invalid hash) error. Then i try to generate hash with BCrypt::Engine.hash_secret('secret', BCrypt::Engine.generate_salt(1)) to see what's wrong there and i noticed the code generated 32767 character long string as the following

$2a$04$tk0ZskJEMxKW5Zx0OIMy/Ot5z.Vleg7SXfRV9.GryPpKRchRK/S3m\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\............

Because of unexpected long hash string the valid_hash? method returns nil and broke the app.

I test the problem against to ruby 2.4.1, 2.5.0 and 2.5.1 on Fedora 28. All of them were failing.

I check the GCC version and noticed that it upgraded to 8.x on Fedora 28. I am not sure, but it could be a compiler related bug..

ankitsinghaniyaz and Hyperadministrator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.