couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wohali <...@git.apache.org>
Subject [GitHub] couchdb pull request: fixes COUCHDB-2362 admin auth in dev cluster
Date Sat, 25 Oct 2014 23:11:18 GMT
Github user wohali commented on a diff in the pull request:

    https://github.com/apache/couchdb/pull/269#discussion_r19378084
  
    --- Diff: dev/pbkdf2.py ---
    @@ -0,0 +1,130 @@
    +# -*- coding: utf-8 -*-
    +"""
    +    pbkdf2
    +    ~~~~~~
    +
    +    This module implements pbkdf2 for Python.  It also has some basic
    +    tests that ensure that it works.  The implementation is straightforward
    +    and uses stdlib only stuff and can be easily be copy/pasted into
    +    your favourite application.
    +
    +    Use this as replacement for bcrypt that does not need a c implementation
    +    of a modified blowfish crypto algo.
    +
    +    Example usage:
    +
    +    >>> pbkdf2_hex('what i want to hash', 'the random salt')
    +    'fa7cc8a2b0a932f8e6ea42f9787e9d36e592e0c222ada6a9'
    +
    +    How to use this:
    +
    +    1.  Use a constant time string compare function to compare the stored hash
    +        with the one you're generating::
    +
    +            def safe_str_cmp(a, b):
    +                if len(a) != len(b):
    +                    return False
    +                rv = 0
    +                for x, y in izip(a, b):
    +                    rv |= ord(x) ^ ord(y)
    +                return rv == 0
    +
    +    2.  Use `os.urandom` to generate a proper salt of at least 8 byte.
    +        Use a unique salt per hashed password.
    +
    +    3.  Store ``algorithm$salt:costfactor$hash`` in the database so that
    +        you can upgrade later easily to a different algorithm if you need
    +        one.  For instance ``PBKDF2-256$thesalt:10000$deadbeef...``.
    +
    +
    +    :copyright: (c) Copyright 2011 by Armin Ronacher.
    +    :license: BSD, see LICENSE for more details.
    --- End diff --
    
    Need to import this as LICENSE.pbkdf2.txt or simliar I think.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message