Code Monkey home page Code Monkey logo

Comments (5)

hynek avatar hynek commented on July 20, 2024

I'm not sure I 100% understood, so just to double-check:

You'd like that the server sends the client a salt (presumably the salt that it added to its own password) and the client returns an argon2 hash with said salt and the server can just compare its own hash with the one the client sent? 🤔

from argon2-cffi.

aviv-barel-pp avatar aviv-barel-pp commented on July 20, 2024

No, I would like that the client will have a salt that is never shared with the server.
so the client won't have to send the actual password to the server, but will use a constant argon2 hash instead.

This is the flow I have in my mind
Client code:

def get_temporary_token_from_server(user_name, user_password):
    ph = PasswordHasher(salt=os.environ.get("CLIENT_SALT")
    argon2_hash = ph.hash(user_password)
    token_from_server = server.get_token(user_name=user_name, password_hash=argon2_hash)

Server code:

def verify_password_hash(user_name, hash_from_client):
    user = get_user(user_name) # In the DB we store for each user argon2_hash and a unique random salt)
    user_hash_to_verify = concat(hash_from_client + user.user_salt)

    ph = PasswordHasher()
    # here we verify that the user.password_hash is a valid argon2 hash for user_hash_to_verify which is a constant string we can create by concating the constant argon2_hash sent via the client and the salt kept for this user in the server DB
    ph.verify(user.password_hash, user_hash_to_verify)
  • the client will use a constant salt stored securely and unavailable to the server (this salt should be generated with secure random function)
  • client salt is not being sent to the server
  • the server will never know the user actual password
  • the server may keep a salt for each user that the client isn't aware of.

from argon2-cffi.

hynek avatar hynek commented on July 20, 2024

I presume #153 would fix your problem?

from argon2-cffi.

aviv-barel-pp avatar aviv-barel-pp commented on July 20, 2024

yes, thanks 👍

from argon2-cffi.

hynek avatar hynek commented on July 20, 2024

23.1.0 is on PyPI

from argon2-cffi.

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.