Skip to content

String#crypt behaving differently that in MRI #1035

@nning

Description

@nning

I tried getting a Rails project working on JRuby 1.7.4 and a test
regarding password hashes failed. Passwords hashes are created by:

password.crypt('$6$' + salt)

On JRuby 1.7.4 the output looks like:

$ jruby -e 'p "foobar".crypt(%q($6$2mlKb.sZpswpnZlt))'
"$6GFbj3O6XCj2"

On MRI 1.9.3-p448:

$ mri19 -e 'p "foobar".crypt(%q($6$2mlKb.sZpswpnZlt))'
"$6$2mlKb.sZpswpnZlt$yT2dFkrWNtGzxVDgTon7BN2RSh8QRZAznZn.d6ocP/QkAXMTKVXTi0z931ocCYQhvFPzlZPr/OPEmfw8C9pDJ."

And on MRI 2.0.0-247:

$ mri20 -e 'p "foobar".crypt(%q($6$2mlKb.sZpswpnZlt))'
"$6$2mlKb.sZpswpnZlt$yT2dFkrWNtGzxVDgTon7BN2RSh8QRZAznZn.d6ocP/QkAXMTKVXTi0z931ocCYQhvFPzlZPr/OPEmfw8C9pDJ."

I am developing on Arch Linux with glibc 2.18, RUBY_DESCRIPTION in JRuby is:

jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.7.0_40-b31 +indy [linux-amd64]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions