Code Monkey home page Code Monkey logo

Comments (4)

Brendan-McDonnell avatar Brendan-McDonnell commented on July 19, 2024

It may also be useful to set some flag for which set of default parameters may be preferred.

Some possible implementations:

  1. Boolean reduced_memory. Causes defaults to be overwritten by reduced memory defaults.
  2. Passing a parameter object. Could be part of the constructor and override defaults or separate from constructor as a class method:
    class PasswordHasher:
        ...
        @classmethod
        def with_default_parameters(cls, parameters: Parameters) -> PasswordHasher:
            # note: DefaultParameters and LowMemoryDefeaultParameters objects
            # would need to be defined elsewhere
            return PasswordHasher(
                time_cost=parameter.time_cost,
                ...
            )
    (This isn't a complete implementation, as it doesn't allow for parameter override --- just a proof of concept)
  3. LowMemoryPasswordHasher child class.

from argon2-cffi.

hynek avatar hynek commented on July 19, 2024

Hi Brendan, sorry for the long silence. When you opened this issue I was traveling (!!!!) and I've been procrastinating on a release ever since because it's a big topic.

I think the best way forward is making the low-mem case the default and allow to create hashers from Parameters as per your option 2.

It was so clear that they had to publish the final version a few days after I published a basically non-release. šŸ¤Ŗ

from argon2-cffi.

Brendan-McDonnell avatar Brendan-McDonnell commented on July 19, 2024

I think the best way forward is making the low-mem case the default and allow to create hashers from Parameters as per your option 2.

Would this provide a default high memory Parameters object? e.g. something like

from argon2 import PasswordHasher, HighMemoryParameters

high_mem_hasher = PasswordHasher.from_parameters(HighMemoryParameters)

from argon2-cffi.

hynek avatar hynek commented on July 19, 2024

Yeah, Iā€™d supply both RFC options at least. Maybe additionally the current defaults for people who want to keep them. Could live in a separate module argon2.profiles.RFC9106HighMemory or something.

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.