technion / ruby-argon2

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

Argon2::Password.valid_hash? to support different hashings #27

Closed pacoguzman closed 5 years ago

pacoguzman commented 5 years ago

Hey everyone!

I would like to introduce Argon2::Password.valid_hash? as a guard so we can easily check which algorithm we should use to match the secret_password and the password provided for the users, as we imported data from different applications which uses different hashing algorithms.

Ref: https://github.com/codahale/bcrypt-ruby/blob/84c8d7b6b5492920631078594d0788f3ca205ecb/lib/bcrypt/password.rb#L49-L51

      def valid_hash?(h)
        h =~ /^\$[0-9a-z]{2}\$[0-9]{2}\$[A-Za-z0-9\.\/]{53}$/
      end
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 130


Totals Coverage Status
Change from base Build 129: 0.0%
Covered Lines: 189
Relevant Lines: 189

💛 - Coveralls
pacoguzman commented 5 years ago

@technion it seems there are problems with jruby on Travis

https://travis-ci.org/technion/ruby-argon2/jobs/481234800

technion commented 5 years ago

@pacoguzman jruby appears broken by the new bundler.. I'll have to look into that.

Thank you for this PR, looks good.

pacoguzman commented 5 years ago

Yes, it seems so.

You're welcome. Any plan to make a bump? we would like to start using and would be great to directly point to a specific version.

technion commented 5 years ago

Looks like a useful feature. Bump incoming tonight.