Code Monkey home page Code Monkey logo

Comments (2)

technion avatar technion commented on August 15, 2024 1

The value for the salt is generated randomly when you call "create" as a part of the initialisation:

https://github.com/technion/ruby-argon2/blob/master/lib/argon2.rb#L17

It is intended that you get different results for every hash you create (even with the same input), as this is how the salt prevents rainbow attacks.

This is consistent with the operation of bcrypt, and you can read more about this pattern here:
https://stackoverflow.com/questions/39197989/laravel-5-using-bcrypt-on-same-string-gives-different-values

If would only be a bug if those inputs failed to verify, which is checked in the tests here:
https://github.com/technion/ruby-argon2/blob/master/test/rubycheck_test.rb

In your second example, you've reused the hash object, which reuses the salt. This is probably a bad idea, and I'll add some documentation to this effect.

from ruby-argon2.

jisaacks avatar jisaacks commented on August 15, 2024

Thanks so much! That clarified everything.

from ruby-argon2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.