technion / ruby-argon2

A Ruby gem offering bindings for Argon2 password hashing
MIT License
229 stars 30 forks source link

Adds support for Windows #31

Closed ankane closed 5 years ago

ankane commented 5 years ago

Hi @technion, the library compiles on Windows with RubyInstaller's Devkit (found this when looking at how the bcrypt gem works on Windows), but it can't find the path to the DLL. This fixes it.

Tested on Windows 10.

coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 152


Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/argon2/ffi_engine.rb 2 3 66.67%
<!-- Total: 2 3 66.67% -->
Totals Coverage Status
Change from base Build 150: -0.5%
Covered Lines: 192
Relevant Lines: 193

💛 - Coveralls
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 152


Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/argon2/ffi_engine.rb 2 3 66.67%
<!-- Total: 2 3 66.67% -->
Totals Coverage Status
Change from base Build 150: -0.5%
Covered Lines: 192
Relevant Lines: 193

💛 - Coveralls
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 153


Totals Coverage Status
Change from base Build 150: 0.0%
Covered Lines: 191
Relevant Lines: 191

💛 - Coveralls
ankane commented 5 years ago

There may be a cleaner way to do this, but the basic problem is:

FFI::Compiler::Platform.system.map_library_name("argon2_wrap")

returns libargon2_wrap.bundle on Mac and argon2_wrap.dll on Windows, and libargon2_wrap.dll is the actual file created on Windows. It sounds like this approach worked for @xlavoie as well - see https://github.com/technion/ruby-argon2/issues/1#issuecomment-483792500

Could also change the name of the compiled file, like: https://github.com/technion/ruby-argon2/commit/59477048f52de01ffd7e5f48c397931a85df0236

technion commented 5 years ago

I'll take this as it appears to be a simple and small patch, but I want to be clear I'm not officially supporting Windows.

ankane commented 5 years ago

Thanks @technion

ankane commented 5 years ago

fwiw, I was also able to get AppVeyor passing: https://ci.appveyor.com/project/ankane/ruby-argon2

technion commented 5 years ago

Great. I noticed jRuby apparently broke.. but it's not this commit. I'll look at some travis fixes that address both of those.