Git Product home page Git Product logo

argon2-cffi's People

Contributors

apollo13 avatar asottile avatar bwesterb avatar clamytoe avatar dependabot[bot] avatar hynek avatar isidroas avatar jameshilliard avatar koobs avatar mithrandi avatar mkniewallner avatar nealmcb avatar ofek avatar pre-commit-ci[bot] avatar seifertm avatar step-security-bot avatar timgraham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

argon2-cffi's Issues

Downloading fails, since build starts

We host a simple pypi server in our company.

This command works for most pip package, but it fails for argon2-cffi:

pypi@pypihost:~> pip install  -d packages argon2-cffi
Collecting argon2-cffi
  File was already downloaded packages/argon2_cffi-16.2.0.tar.gz
    Complete output from command python setup.py egg_info:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:15:17: fatal error: ffi.h: Datei oder Verzeichnis nicht gefunden
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/pypi/tmp/pip-build-LJ1EjJ/argon2-cffi/setup.py", line 206, in <module>
        extras_require=EXTRAS_REQUIRE,
      File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/pypi/lib/python2.7/site-packages/setuptools/dist.py", line 265, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/home/pypi/lib/python2.7/site-packages/setuptools/dist.py", line 310, in fetch_build_eggs
        replace_conflicting=True,
      File "/home/pypi/lib/python2.7/site-packages/pkg_resources/__init__.py", line 824, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/home/pypi/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1069, in best_match
        return self.obtain(req, installer)
      File "/home/pypi/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1081, in obtain
        return installer(requirement)
      File "/home/pypi/lib/python2.7/site-packages/setuptools/dist.py", line 377, in fetch_build_egg
        return cmd.easy_install(req)
      File "/home/pypi/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 629, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/pypi/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 659, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/pypi/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 842, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/home/pypi/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1070, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/home/pypi/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1058, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /home/pypi/tmp/pip-build-LJ1EjJ/argon2-cffi/

I don't want gcc to run in this case, since I only want to download it.

What I am doing wrong?

Same issue on StackO: http://stackoverflow.com/questions/40038861/downloading-but-not-installing-argon2-cffi

seems missing _ffi.abi3.so when pip installing in docker

Hi,

We encountered a weird error when installing the argon2 in Alpine Linux Docker.
When using the argon2 as part of hasher in Django, it triggers an error saying Couldn't load 'Argon2PasswordHasher' algorithm library: No module named 'argon2._ffi'

After we looked into the docker's site-package, we found that the argon2 directory is missing the _ffi.abi3.so file which generates this error. We rebuilt the docker several times and the error still exists, it can be reproduced every time.

Python: 3.6.10
Docker base image: python3.6-alpine3.10
Django: 2.2.4
Argon2: 19.1.0

So is there any better solutions than copying so file directly into docker? and I was wondering what makes this happen?

Manually set salt (or no salt) for deterministic hashes

Hi,

It would be useful if salt_len could be set to 0 for deterministic passwords, set a specific salt, or something else.

Say you have a weak password: "foobar".

You want to strengthen the password, then derive a hash from it.

From that hash, you derive other passwords. You carry no state and want to be able to reproduce from the original password with no other data. I know this is very different than the current intent but it's a very simple change that should make it quite versatile.

Thank you!

hash generated on 18.3.0/19.1.0 fails to verify on 18.1.0

I'm generating hashes with 18.3.0 and 19.1.0 and they're failing to validate with 18.1.0, with a decoding error. I thought this might be due to the change to argon2di by default, but even forcing d format doesn't make a difference. Forcing i format works though.

On 19.1.0:

>>> import argon2
>>> from argon2 import PasswordHasher
>>> ph=argon2.PasswordHasher(type=argon2.Type.D)
>>> ph.hash('foo')
u'$argon2d$v=19$m=102400,t=2,p=8$+dkJA3heBNgzLt4ZJ244mQ$vy3GwRpCXVty3x/W4VjMqQ'

Then verify on 18.1.0:

>>> ph.verify(u'$argon2d$v=19$m=102400,t=2,p=8$+dkJA3heBNgzLt4ZJ244mQ$vy3GwRpCXVty3x/W4VjMqQ', 'foo')
Traceback (most recent call last):
...
argon2.exceptions.VerificationError: Decoding failed

Maybe this is a known incompatibility but I didn't see it in the changelog.

`enum34` dependency breaks some installs

First off, I'm not convinced if this should be a bug report here, but at the very least, I can suggest it.

Essentially, it seems that installing enum34 in environments of Python 3.6 and above can break certain codebases (see: https://stackoverflow.com/q/43124775), including mine. It seems enum34 is often loaded/imported ahead of the standard-library's enum, and the APIs have slightly diverged since Python 3.4.

Now, you may be thinking, "I know, that's why there's a check in setup.py" (see: https://github.com/hynek/argon2_cffi/blob/master/setup.py#L98). However, this sort of protection seems to not work really well with the more "modern" packaging solutions, like pipenv and poetry (see: pypa/pipenv#924, python-poetry/poetry#758), because the python version running the setup.py may not be the same version being deployed, and as they generate consistent lockfiles, regardless of the running python version.

It seems a nuisance, as the onus maybe should be on the package managers to figure it out. However, I would like to suggest/request that

a) the support for pre-3.4 python versions be dropped by removing the dependency on enum34, or

b) the package be split between a enum34 installable and non-enum34 installable. I think this can be achieved pretty easily with the extras_require argument in setuptools, such that

pip install argon2-cffi

would install without enum34, and

pip install argon2-cffi[enum34]

would install with enum34. If it helps, this project showcases the usecase in action, and this code shows how it's done.

Or,

c) take advantage of environment markers in setup.py instead. I don't fully understand what that means or entails, so I have a hard time recommending it, but this comment seems to suggest it as an alternative to doing a sys.version_info check.

If a) or b) sound logical, I can submit a PR.

Some parameter combinations cause a password to not validate against itself

Hi, I read Storing Passwords in a Highly Parallelized World and thought it might be interesting to apply Hypothesis to testing your argon2 bindings.

This resulted in the following example:

    def test_a_password_verifies(self):
        ph = PasswordHasher(
            time_cost=1, parallelism=1,
            memory_cost=8,
            hash_len=4, salt_len=8,
        )
        password = ''
        hash = ph.hash(password)
        assert ph.verify(hash, password)

i.e. we set up a hasher with some parameters, then hash a password and validate it against itself. This test passes correctly with the default parameter values but fails with these ones.

This fails with "argon2.exceptions.VerificationError: Decoding failed"

(The fact that the password is empty appears to not be significant - it still fails with e.g. '0')

I'm insufficiently familiar with the problem space to know whether this is likely to be an issue in the bindings, the underlying library, or indeed just me doing something subtly wrong, so I thought I'd pass this over to you.

I am also happy to submit a pull request to add the original Hypothesis based tests (which just tries a large number of examples like the above) to your suite if you'd like me to.

RFC is no longer a draft (RFC9106); default parameter choice out of date

Argon2 now has an official informational RFC, not just a draft: RFC 9106. This change occurred on September 7th.

The previous RFC draft is referenced in two locations:

  1. PasswordHasher's docstring
  2. The "Parameters" documentation

and default parameters (no longer in line with the RFC) are implemented in PasswordHasher.

I believe the parameter choice changes were made in #41 in 2018. Since then, the draft went through revisions 4 through 13 before being marked as done. Since then, the Parameter Choice section has changed (diff here).

The RFC now recommends the following:

  1. If a uniformly safe option that is not tailored to your
    application or hardware is acceptable, select Argon2id with t=1
    iteration, p=4 lanes, m=2^(21) (2 GiB of RAM), 128-bit salt, and
    256-bit tag size. This is the FIRST RECOMMENDED option.

  2. If much less memory is available, a uniformly safe option is
    Argon2id with t=3 iterations, p=4 lanes, m=2^(16) (64 MiB of
    RAM), 128-bit salt, and 256-bit tag size. This is the SECOND
    RECOMMENDED option.

  3. Otherwise, start with selecting the type y. If you do not know
    the difference between the types or you consider side-channel
    attacks to be a viable threat, choose Argon2id.

  4. Select p=4 lanes.

  5. Figure out the maximum amount of memory that each call can
    afford and translate it to the parameter m.

  6. Figure out the maximum amount of time (in seconds) that each
    call can afford.

  7. Select the salt length. A length of 128 bits is sufficient for
    all applications but can be reduced to 64 bits in the case of
    space constraints.

  8. Select the tag length. A length of 128 bits is sufficient for
    most applications, including key derivation. If longer keys are
    needed, select longer tags.

  9. If side-channel attacks are a viable threat or if you're
    uncertain, enable the memory-wiping option in the library call.

  10. Run the scheme of type y, memory m, and p lanes using a
    different number of passes t. Figure out the maximum t such
    that the running time does not exceed the affordable time. If
    it even exceeds for t = 1, reduce m accordingly.

  11. Use Argon2 with determined values m, p, and t.

Major changes:

  1. There are now two recommended general use options for different memory requirements.
  2. Four lanes instead of twice the number of dedicated cores.
  3. There is no longer a recommendation for the maximum memory.
  4. There is no longer a recommendation for the maximum time.
  5. The RFC references the memory-wiping function for side-channel attack mitigation.

argon-cffi's parameter choice should be updated to reflect the official RFC and documentation should be updated.

Currently, the default parameters are as follows:

DEFAULT_RANDOM_SALT_LENGTH = 16
DEFAULT_HASH_LENGTH = 16
DEFAULT_TIME_COST = 2
DEFAULT_MEMORY_COST = 102400
DEFAULT_PARALLELISM = 8

They should be adapted to one of the recommended general use options:

# Default (high memory use)
DEFAULT_RANDOM_SALT_LENGTH = 16    # 128-bit salt
DEFAULT_HASH_LENGTH = 32           # 256-bit tag size
DEFAULT_TIME_COST = 1              # t = 1 iteration
DEFAULT_MEMORY_COST = 2097152      # m=2^(21) (2 GiB of RAM)
DEFAULT_PARALLELISM = 4            # p = 4 lanes

# Low memory use
DEFAULT_RANDOM_SALT_LENGTH = 16    # 128-bit salt
DEFAULT_HASH_LENGTH = 32           # 256-bit tag size
DEFAULT_TIME_COST = 3              # t = 3 iterations
DEFAULT_MEMORY_COST = 65536        # m=2^(16) (64 MiB of RAM)
DEFAULT_PARALLELISM = 4            # p = 4 lanes

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

Finally, having a utility to automatically find t given the other parameters, as per the following:

  1. Run the scheme of type y, memory m, and p lanes using a
    different number of passes t. Figure out the maximum t such
    that the running time does not exceed the affordable time. If
    it even exceeds for t = 1, reduce m accordingly.

It's time for everyone to make good use of check_needs_rehash!

PasswordHasher is removed in 0.1.10, how to generate password?

New to this library but the docs don't seem to match the library anymore.

from argon2 import PasswordHasher
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'PasswordHasher'
import argon2
dir(argon2)
['ARRAY', 'Argon2Exception', 'Argon2Type', 'ArgumentError', 'Array', 'BigEndianStructure', 'CDLL', 'CFUNCTYPE', 'DEFAULT_MODE', 'IS_PY2', 'LibraryLoader', 'LittleEndianStructure', 'POINTER', 'PYFUNCTYPE', 'PyDLL', 'RTLD_GLOBAL', 'RTLD_LOCAL', 'SetPointerType', 'Structure', 'Union', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'spec', 'warningregistry', '_argon2', '_crypto_argon2', '_ensure_bytes', 'addressof', 'alignment', 'argon2_hash', 'byref', 'c_bool', 'c_buffer', 'c_byte', 'c_char', 'c_char_p', 'c_double', 'c_float', 'c_int', 'c_int16', 'c_int32', 'c_int64', 'c_int8', 'c_long', 'c_longdouble', 'c_longlong', 'c_short', 'c_size_t', 'c_ssize_t', 'c_ubyte', 'c_uint', 'c_uint16', 'c_uint32', 'c_uint64', 'c_uint8', 'c_ulong', 'c_ulonglong', 'c_ushort', 'c_void_p', 'c_voidp', 'c_wchar', 'c_wchar_p', 'cast', 'cdll', 'create_string_buffer', 'create_unicode_buffer', 'get_errno', 'imp', 'memmove', 'memset', 'os', 'platform', 'pointer', 'py_object', 'pydll', 'pythonapi', 'resize', 'set_errno', 'sizeof', 'string_at', 'sys', 'system_type', 'wstring_at']

How to implement a progress bar

My use case involves relatively expensive hashing using argon2. Expensive enough to warrant a progress bar. Is there any way I could hook up a callback so that the progress bar would be meaningful?

If this is not possible, what would the security risk be, if I did repeated hashing outside of the argon2 module, for example like this:

# pseudocode
def argon_with_progress(in_data, progress_callback, time_cost=1000):
    current_hash_value = in_data
    for i in range(100):
        current_hash_value = argon2hash(hash_value, time_cost=time_cost // 100)
        progress_callback(i / 100.0)
    return current_hash_value

Doesn't work with pypy

With pypy it's show:

ImportError: No module named argon2._ffi

Like in travis build (same error)

More Log:

/bin/ld: cannot find -llibargon2
collect2: error: ld returned 1 exit status
Traceback (most recent call last):
  File "src/argon2/_ffi_build.py", line 167, in <module>
    ffi.compile()
  File "/opt/pypy-nightly/lib_pypy/cffi/api.py", line 599, in compile
    source_extension=source_extension, **kwds)
  File "/opt/pypy-nightly/lib_pypy/cffi/recompiler.py", line 1255, in recompile
    outputfilename = ffiplatform.compile('.', ext)
  File "/opt/pypy-nightly/lib_pypy/cffi/ffiplatform.py", line 28, in compile
    outputfilename = _build(tmpdir, ext)
  File "/opt/pypy-nightly/lib_pypy/cffi/ffiplatform.py", line 54, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
VerificationError: LinkError: command 'cc' failed with exit status 1

Wheel support for linux aarch64

Summary
Installing argon2-cffi on aarch64 via pip using command "pip3 install argon2-cffi" tries to build wheel from source code

Problem description
argon2-cffi doesn't have wheel for aarch64 on PyPI repository. So, while installing argon2-cffi via pip on aarch64, pip builds wheel for same resulting in it takes more time to install argon2-cffi. Making wheel available for aarch64 will benefit aarch64 users by minimizing argon2-cffi installation time.

Expected Output
Pip should be able to download argon2-cffi wheel from PyPI repository rather than building it from source code.

@argon2-cffi-team, please let me know if I can help you building wheel/uploading to PyPI repository. I am curious to make argon2-cffi wheel available for aarch64. It will be a great opportunity for me to work with you.

invalid ELF header (Apache 2.4, mod_wsgi, python 2.7.12)

I use argon2-cffi==18.1.0 with framework flask==1.0.2, on Server Ubuntu 16.04 and Apahe 2.4 with mod_wsgi. When I try to run page I have Internal Server Error with status code 500
in Apach2 error.log:
ImportError: /var/www/fra/env/lib/python2.7/site-packages/argon2/_ffi.so: invalid ELF header

How to verify secret for low_level not clear

How do you use the verify secret function for a hash generated by argon2.low_level.hash_secret_raw. This function returns only bytes, but it is not the full hash used with the low level verify secret function. How should the hash produced by hash_secret_raw be verified along with the salt used to create it?

Deprecation warning popping up

Getting this warning message using the library.

.../argon2/low_level.py:93: UserWarning: implicit cast to 'char *' from a different pointer type: will be forbidden in the future (check that the types are as you expect; use an explicit ffi.cast() if they are correct)

pypy wheels?

Would it be possible to get pypy wheels on PyPI? It looks like you already have pypy running on Travis and Appveyor. I don't know whether you also use them for releases.

We currently can't easily run pypy tests for devpi on Travis and Appveyor, because this library would need to be compiled and it doesn't seem to be straight forward to do so. With wheels for pypy it would be much easier for us and installation of devpi with pypy would be a lot easier for other people as well.

PHC string format

The Modular Crypt Format used by argon2_cffi doesn't seem to adhere to the official PHC string format standard. Specifically the v parameter is illegal. Using the README's example, the correct hash is $argon2i$m=512,t=2,p=2$5VtWOO3cGWYQHEMaYGbsfQ$AcmqasQgW/wI6wAHAMk4aQ (note the missing $v=19 right after $argon2i).

Fix verify to return false instead of raising error

Hey!

On your article you said:

In case you wonder why verify() raises an exception instead of just returning False: the Argon2 library has no concept of a โ€œwrong passwordโ€ error. Therefore an exception with the full error is raised so you can inspect what went wrong if needed. Also IMHO a wrong password should raise an exception such that it canโ€™t pass unnoticed by accident.

That's not true anymore since b07d7b6 ๐Ÿ˜„

Error installing with pip

I am running debian jessie, python 2.7.9 and pip 8.1.2
All the regular python dev libs are installed through apt-get
Am I missing something?

NOTE: I already run "pip install -U cffi pip setuptools", as suggested in the docs.

Here is the error log.

-> pip install argon2_cffi
Collecting argon2_cffi
  Using cached argon2_cffi-16.1.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): six in /home/user/.virtualenvs/adb/lib/python2.7/site-packages (from argon2_cffi)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.0.0 in /home/user/.virtualenvs/adb/lib/python2.7/site-packages (from argon2_cffi)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /home/user/.virtualenvs/adb/lib/python2.7/site-packages (from argon2_cffi)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /home/user/.virtualenvs/adb/lib/python2.7/site-packages (from cffi>=1.0.0->argon2_cffi)
Installing collected packages: argon2-cffi
  Running setup.py install for argon2-cffi ... error
    Complete output from command /home/user/.virtualenvs/adb/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xmwom4/argon2-cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bGV2QA-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/.virtualenvs/adb/include/site/python2.7/argon2-cffi:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-i686-2.7
    creating build/lib.linux-i686-2.7/argon2
    copying src/argon2/__main__.py -> build/lib.linux-i686-2.7/argon2
    copying src/argon2/exceptions.py -> build/lib.linux-i686-2.7/argon2
    copying src/argon2/_ffi_build.py -> build/lib.linux-i686-2.7/argon2
    copying src/argon2/__init__.py -> build/lib.linux-i686-2.7/argon2
    copying src/argon2/_legacy.py -> build/lib.linux-i686-2.7/argon2
    copying src/argon2/low_level.py -> build/lib.linux-i686-2.7/argon2
    copying src/argon2/_utils.py -> build/lib.linux-i686-2.7/argon2
    copying src/argon2/_password_hasher.py -> build/lib.linux-i686-2.7/argon2
    running build_clib
    building 'libargon2' library
    creating build/temp.linux-i686-2.7
    creating build/temp.linux-i686-2.7/extras
    creating build/temp.linux-i686-2.7/extras/libargon2
    creating build/temp.linux-i686-2.7/extras/libargon2/src
    creating build/temp.linux-i686-2.7/extras/libargon2/src/blake2
    i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/argon2.c -o build/temp.linux-i686-2.7/extras/libargon2/src/argon2.o
    i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/blake2/blake2b.c -o build/temp.linux-i686-2.7/extras/libargon2/src/blake2/blake2b.o
    i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/core.c -o build/temp.linux-i686-2.7/extras/libargon2/src/core.o
    i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/encoding.c -o build/temp.linux-i686-2.7/extras/libargon2/src/encoding.o
    i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/opt.c -o build/temp.linux-i686-2.7/extras/libargon2/src/opt.o
    In file included from extras/libargon2/src/opt.c:22:0:
    extras/libargon2/src/blake2/blamka-round-opt.h: In function โ€˜fBlaMkaโ€™:
    extras/libargon2/src/blake2/blamka-round-opt.h:40:1: warning: SSE vector return without SSE enabled changes the ABI [-Wpsabi]
     static BLAKE2_INLINE __m128i fBlaMka(__m128i x, __m128i y) {
     ^
    In file included from extras/libargon2/src/opt.h:18:0,
                     from extras/libargon2/src/opt.c:19:
    /usr/lib/gcc/i586-linux-gnu/4.9/include/emmintrin.h:1127:1: error: inlining failed in call to always_inline โ€˜_mm_mul_epu32โ€™: target specific option mismatch
     _mm_mul_epu32 (__m128i __A, __m128i __B)
     ^
    In file included from extras/libargon2/src/opt.c:22:0:
    extras/libargon2/src/blake2/blamka-round-opt.h:41:19: error: called from here
         const __m128i z = _mm_mul_epu32(x, y);
                       ^
    In file included from extras/libargon2/src/opt.h:18:0,
                     from extras/libargon2/src/opt.c:19:
    /usr/lib/gcc/i586-linux-gnu/4.9/include/emmintrin.h:1025:1: error: inlining failed in call to always_inline โ€˜_mm_add_epi64โ€™: target specific option mismatch
     _mm_add_epi64 (__m128i __A, __m128i __B)
     ^
    In file included from extras/libargon2/src/opt.c:22:0:
    extras/libargon2/src/blake2/blamka-round-opt.h:42:12: error: called from here
         return _mm_add_epi64(_mm_add_epi64(x, y), _mm_add_epi64(z, z));
                ^
    In file included from extras/libargon2/src/opt.h:18:0,
                     from extras/libargon2/src/opt.c:19:
    /usr/lib/gcc/i586-linux-gnu/4.9/include/emmintrin.h:1025:1: error: inlining failed in call to always_inline โ€˜_mm_add_epi64โ€™: target specific option mismatch
     _mm_add_epi64 (__m128i __A, __m128i __B)
     ^
    In file included from extras/libargon2/src/opt.c:22:0:
    extras/libargon2/src/blake2/blamka-round-opt.h:42:12: error: called from here
         return _mm_add_epi64(_mm_add_epi64(x, y), _mm_add_epi64(z, z));
                ^
    In file included from extras/libargon2/src/opt.h:18:0,
                     from extras/libargon2/src/opt.c:19:
    /usr/lib/gcc/i586-linux-gnu/4.9/include/emmintrin.h:1025:1: error: inlining failed in call to always_inline โ€˜_mm_add_epi64โ€™: target specific option mismatch
     _mm_add_epi64 (__m128i __A, __m128i __B)
     ^
    In file included from extras/libargon2/src/opt.c:22:0:
    extras/libargon2/src/blake2/blamka-round-opt.h:42:12: error: called from here
         return _mm_add_epi64(_mm_add_epi64(x, y), _mm_add_epi64(z, z));
                ^
    error: command 'i586-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/home/user/.virtualenvs/adb/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xmwom4/argon2-cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bGV2QA-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/.virtualenvs/adb/include/site/python2.7/argon2-cffi" failed with error code 1 in /tmp/pip-build-xmwom4/argon2-cffi/

20.1.0: sphinx warnings

$ PYTHONPATH=$PWD/src /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
running build_sphinx
Running Sphinx v4.0.2
making output directory... done
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 11 added, 0 changed, 0 removed
reading sources... [100%] parameters
WARNING: autodoc: failed to import class 'PasswordHasher' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'extract_parameters' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import class 'Parameters' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import module 'low_level' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import class 'Type' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import data 'ARGON2_VERSION' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'hash_secret' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'verify_secret' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'hash_secret_raw' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'core' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'error_to_str' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'hash_password' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'hash_password_raw' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
WARNING: autodoc: failed to import function 'verify_password' from module 'argon2'; the following exception was raised:
No module named 'argon2._ffi'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... argon2-cffi.3 { argon2 installation api parameters cli faq backward-compatibility contributing changelog license } done
build succeeded, 14 warnings.

Threading failure causes application to crash

We're seeing the following error being raised if we catch all exceptions:

argon2.exceptions.HashingError: Threading failure"

In some cases is also brings down the entire application without logging anything.

Fail to install by pip on macOS 11.0.1 Big Sur

I tried to install jupyterlab which depends argon2-cffi, but failed at building argon2-cffi.

System:
image

Python version:

> python3 --version
Python 3.8.2

pip version:

> pip3 --version
pip 19.2.3 from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

Toolchains:

> clang --version
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Command and Log:

> pip3 install argon2-cffi --user
Collecting argon2-cffi
  Using cached https://files.pythonhosted.org/packages/74/fd/d78e003a79c453e8454197092fce9d1c6099445b7e7da0b04eb4fe1dbab7/argon2-cffi-20.1.0.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: six in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages (from argon2-cffi) (1.15.0)
Collecting cffi>=1.0.0 (from argon2-cffi)
  Using cached https://files.pythonhosted.org/packages/66/6a/98e023b3d11537a5521902ac6b50db470c826c682be6a8c661549cb7717a/cffi-1.14.4.tar.gz
Collecting pycparser (from cffi>=1.0.0->argon2-cffi)
  Using cached https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl
Building wheels for collected packages: argon2-cffi
  Building wheel for argon2-cffi (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Developer/CommandLineTools/usr/bin/python3 /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/j_/c2k540gj5ts_zyfz7__f76yr0000gn/T/tmp45e__06d
       cwd: /private/var/folders/j_/c2k540gj5ts_zyfz7__f76yr0000gn/T/pip-install-db4uhggy/argon2-cffi
  Complete output (90 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14.6-x86_64-3.8
  creating build/lib.macosx-10.14.6-x86_64-3.8/argon2
  copying src/argon2/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/argon2
  copying src/argon2/low_level.py -> build/lib.macosx-10.14.6-x86_64-3.8/argon2
  copying src/argon2/_ffi_build.py -> build/lib.macosx-10.14.6-x86_64-3.8/argon2
  copying src/argon2/_password_hasher.py -> build/lib.macosx-10.14.6-x86_64-3.8/argon2
  copying src/argon2/exceptions.py -> build/lib.macosx-10.14.6-x86_64-3.8/argon2
  copying src/argon2/_legacy.py -> build/lib.macosx-10.14.6-x86_64-3.8/argon2
  copying src/argon2/__main__.py -> build/lib.macosx-10.14.6-x86_64-3.8/argon2
  copying src/argon2/_utils.py -> build/lib.macosx-10.14.6-x86_64-3.8/argon2
  running build_clib
  building 'argon2' library
  creating build/temp.macosx-10.14.6-x86_64-3.8
  creating build/temp.macosx-10.14.6-x86_64-3.8/extras
  creating build/temp.macosx-10.14.6-x86_64-3.8/extras/libargon2
  creating build/temp.macosx-10.14.6-x86_64-3.8/extras/libargon2/src
  creating build/temp.macosx-10.14.6-x86_64-3.8/extras/libargon2/src/blake2
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/argon2.c -o build/temp.macosx-10.14.6-x86_64-3.8/extras/libargon2/src/argon2.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/blake2/blake2b.c -o build/temp.macosx-10.14.6-x86_64-3.8/extras/libargon2/src/blake2/blake2b.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/core.c -o build/temp.macosx-10.14.6-x86_64-3.8/extras/libargon2/src/core.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/encoding.c -o build/temp.macosx-10.14.6-x86_64-3.8/extras/libargon2/src/encoding.o
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/opt.c -o build/temp.macosx-10.14.6-x86_64-3.8/extras/libargon2/src/opt.o
  In file included from extras/libargon2/src/opt.c:26:
  In file included from extras/libargon2/src/blake2/blamka-round-opt.h:23:
  In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/emmintrin.h:13:
  In file included from /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/xmmintrin.h:13:
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:50:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:129:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:159:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:189:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:216:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:239:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:260:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:287:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:310:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:331:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:352:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:373:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:394:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:416:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:439:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:461:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:483:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:504:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/mmintrin.h:525:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
      return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for argon2-cffi
  Running setup.py clean for argon2-cffi
Failed to build argon2-cffi
Building wheels for collected packages: cffi
  Building wheel for cffi (setup.py) ... done
  Created wheel for cffi: filename=cffi-1.14.4-cp38-cp38-macosx_10_14_6_x86_64.whl size=258021 sha256=acbb7806e54c30d92c413b20f8dda619fbee180b965ab5727803b524150bb0a7
  Stored in directory: /Users/yezhou/Library/Caches/pip/wheels/0b/5a/01/5220481b9a4717ba183b738c9ee7d773ad32548555a339345a
Successfully built cffi
ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly
> pip3 install argon2-cffi --user --no-use-pep517
Collecting argon2-cffi
  Using cached https://files.pythonhosted.org/packages/74/fd/d78e003a79c453e8454197092fce9d1c6099445b7e7da0b04eb4fe1dbab7/argon2-cffi-20.1.0.tar.gz
ERROR: Disabling PEP 517 processing is invalid: project specifies a build backend of setuptools.build_meta in pyproject.toml

Installing on Ubuntu 16.04 misses libffi-dev dependency

Using pip install argon2-cffi detects and, if necessary, installs libffi just fine. However, it doesn't install libffi-dev, which is needed for the header file ffi.h during install.

Here's the install log:

Running setup.py install for cffi
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    building '_cffi_backend' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /home/dusktreader/.virtualenvs/flask-praetorian/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-_kUQWX/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-q5qIJv-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/dusktreader/.virtualenvs/flask-praetorian/include/site/python2.7:
    Package libffi was not found in the pkg-config search path.
    
    Perhaps you should add the directory containing `libffi.pc'
    
    to the PKG_CONFIG_PATH environment variable
    
    No package 'libffi' found
    
    Package libffi was not found in the pkg-config search path.
    
    Perhaps you should add the directory containing `libffi.pc'
    
    to the PKG_CONFIG_PATH environment variable
    
    No package 'libffi' found
    
    Package libffi was not found in the pkg-config search path.
    
    Perhaps you should add the directory containing `libffi.pc'
    
    to the PKG_CONFIG_PATH environment variable
    
    No package 'libffi' found
    
    Package libffi was not found in the pkg-config search path.
    
    Perhaps you should add the directory containing `libffi.pc'
    
    to the PKG_CONFIG_PATH environment variable
    
    No package 'libffi' found
    
    Package libffi was not found in the pkg-config search path.
    
    Perhaps you should add the directory containing `libffi.pc'
    
    to the PKG_CONFIG_PATH environment variable
    
    No package 'libffi' found
    
    running install
    
    running build
    
    running build_py
    
    creating build
    
    creating build/lib.linux-x86_64-2.7
    
    creating build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/vengine_gen.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/recompiler.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/cparser.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/lock.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/ffiplatform.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/verifier.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/__init__.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/commontypes.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/api.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/model.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/_cffi_include.h -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/parse_c_type.h -> build/lib.linux-x86_64-2.7/cffi
    
    copying cffi/_embedding.h -> build/lib.linux-x86_64-2.7/cffi
    
    running build_ext
    
    building '_cffi_backend' extension
    
    creating build/temp.linux-x86_64-2.7
    
    creating build/temp.linux-x86_64-2.7/c
    
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o
    
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
    
    compilation terminated.
    
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

No running with Python3.6.7

Works with Python3.6.6

pip install argon2_cffi

Collecting argon2_cffi
  Using cached https://files.pythonhosted.org/packages/aa/bb/d620acb83d6e7d0a1f896557524b85e058500bd858ee814d467428718811/argon2_cffi-19.1.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.0.0 in /home/aravind/dicom-viewer/lib/python3.6/site-packages (from argon2_cffi)
Requirement already satisfied (use --upgrade to upgrade): six in /home/aravind/dicom-viewer/lib/python3.6/site-packages (from argon2_cffi)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /home/aravind/dicom-viewer/lib/python3.6/site-packages (from cffi>=1.0.0->argon2_cffi)
Building wheels for collected packages: argon2-cffi
  Running setup.py bdist_wheel for argon2-cffi ... error
  Complete output from command /home/aravind/dicom-viewer/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-mz2sre9w/argon2-cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp2e0gryavpip-wheel- --python-tag cp36:
  /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'project_urls'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/argon2
  copying src/argon2/low_level.py -> build/lib.linux-x86_64-3.6/argon2
  copying src/argon2/_utils.py -> build/lib.linux-x86_64-3.6/argon2
  copying src/argon2/__init__.py -> build/lib.linux-x86_64-3.6/argon2
  copying src/argon2/exceptions.py -> build/lib.linux-x86_64-3.6/argon2
  copying src/argon2/_ffi_build.py -> build/lib.linux-x86_64-3.6/argon2
  copying src/argon2/_password_hasher.py -> build/lib.linux-x86_64-3.6/argon2
  copying src/argon2/__main__.py -> build/lib.linux-x86_64-3.6/argon2
  copying src/argon2/_legacy.py -> build/lib.linux-x86_64-3.6/argon2
  running build_clib
  building 'argon2' library
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/extras
  creating build/temp.linux-x86_64-3.6/extras/libargon2
  creating build/temp.linux-x86_64-3.6/extras/libargon2/src
  creating build/temp.linux-x86_64-3.6/extras/libargon2/src/blake2
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/argon2.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/argon2.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/blake2/blake2b.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/blake2/blake2b.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/core.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/core.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/encoding.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/encoding.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/opt.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/opt.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/thread.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/thread.o
  x86_64-linux-gnu-gcc-ar rc build/temp.linux-x86_64-3.6/libargon2.a build/temp.linux-x86_64-3.6/extras/libargon2/src/argon2.o build/temp.linux-x86_64-3.6/extras/libargon2/src/blake2/blake2b.o build/temp.linux-x86_64-3.6/extras/libargon2/src/core.o build/temp.linux-x86_64-3.6/extras/libargon2/src/encoding.o build/temp.linux-x86_64-3.6/extras/libargon2/src/opt.o build/temp.linux-x86_64-3.6/extras/libargon2/src/thread.o
  running build_ext
  generating cffi module 'build/temp.linux-x86_64-3.6/_ffi.c'
  building '_ffi' extension
  creating build/temp.linux-x86_64-3.6/build
  creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iextras/libargon2/include -I/home/aravind/dicom-viewer/include -I/usr/include/python3.6m -c build/temp.linux-x86_64-3.6/_ffi.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_ffi.o
  build/temp.linux-x86_64-3.6/_ffi.c:22:24: fatal error: pyconfig.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for argon2-cffi
  Running setup.py clean for argon2-cffi
Failed to build argon2-cffi
Installing collected packages: argon2-cffi
  Running setup.py install for argon2-cffi ... error
    Complete output from command /home/aravind/dicom-viewer/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-mz2sre9w/argon2-cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-4w9p0drf-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/aravind/dicom-viewer/include/site/python3.6/argon2-cffi:
    /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'project_urls'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/argon2
    copying src/argon2/low_level.py -> build/lib.linux-x86_64-3.6/argon2
    copying src/argon2/_utils.py -> build/lib.linux-x86_64-3.6/argon2
    copying src/argon2/__init__.py -> build/lib.linux-x86_64-3.6/argon2
    copying src/argon2/exceptions.py -> build/lib.linux-x86_64-3.6/argon2
    copying src/argon2/_ffi_build.py -> build/lib.linux-x86_64-3.6/argon2
    copying src/argon2/_password_hasher.py -> build/lib.linux-x86_64-3.6/argon2
    copying src/argon2/__main__.py -> build/lib.linux-x86_64-3.6/argon2
    copying src/argon2/_legacy.py -> build/lib.linux-x86_64-3.6/argon2
    running build_clib
    building 'argon2' library
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/extras
    creating build/temp.linux-x86_64-3.6/extras/libargon2
    creating build/temp.linux-x86_64-3.6/extras/libargon2/src
    creating build/temp.linux-x86_64-3.6/extras/libargon2/src/blake2
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/argon2.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/argon2.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/blake2/blake2b.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/blake2/blake2b.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/core.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/core.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/encoding.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/encoding.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/opt.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/opt.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -msse2 -Iextras/libargon2/src/../include -Iextras/libargon2/src/blake2 -c extras/libargon2/src/thread.c -o build/temp.linux-x86_64-3.6/extras/libargon2/src/thread.o
    x86_64-linux-gnu-gcc-ar rc build/temp.linux-x86_64-3.6/libargon2.a build/temp.linux-x86_64-3.6/extras/libargon2/src/argon2.o build/temp.linux-x86_64-3.6/extras/libargon2/src/blake2/blake2b.o build/temp.linux-x86_64-3.6/extras/libargon2/src/core.o build/temp.linux-x86_64-3.6/extras/libargon2/src/encoding.o build/temp.linux-x86_64-3.6/extras/libargon2/src/opt.o build/temp.linux-x86_64-3.6/extras/libargon2/src/thread.o
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-3.6/_ffi.c'
    building '_ffi' extension
    creating build/temp.linux-x86_64-3.6/build
    creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iextras/libargon2/include -I/home/aravind/dicom-viewer/include -I/usr/include/python3.6m -c build/temp.linux-x86_64-3.6/_ffi.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_ffi.o
    build/temp.linux-x86_64-3.6/_ffi.c:22:24: fatal error: pyconfig.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/aravind/dicom-viewer/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-mz2sre9w/argon2-cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-4w9p0drf-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/aravind/dicom-viewer/include/site/python3.6/argon2-cffi" failed with error code 1 in /tmp/pip-build-mz2sre9w/argon2-cffi/

How to use keyed hashing?

I'm struggling to figure out how to use the keyed hashing that argon2 provides, any hints? Can't find any mentions of it in the docs, only thing I can find is the ffi declaration. How can this be set from python?

PyCharm is probably confused about src package_dir

Hi.

I've a rather simple project based on setuptools for packaging and a few groups of dependencies (but that's probably not important). Now, I've decided to use this argon2 package for hashing in my app and everything works great, but I keep being nagged by PyCharm that:

Package containing module argon2 is not listed in project requirements.

Which is obviously not true because I've just installed it with help of project requirements. My guess is that PyCharm does not understand package_dir. Now I know that it would be a problem which should be reported to PyCharm issues, however it would probably be much faster to resolve the problem with update to structure of this repo.

Thanks for this project and feel free to close this issue if you disagree.

some thing is missing in documents(readthedocs.io)

hello!
first I want to say thankyou to developers of this great module. I'm using argon2_cffi to write a password manager program (or programm with double m, I don't know which one is correct!). after searching about hash for a week, I finally chosed argon2 for saving master password. then, between argon2i,argon2d and argon2id, I chosed id(is it secure for my use?).then, I wrote my program past few days(part of it), and started debuging it today. after fixing some little bugs, I saw this:

 File "passwordmanager.py", line 73, in <module>
    correct_password=verify_password(hash=correct_master_password.encode(),password=entered_master_password.encode())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/argon2/_legacy.py", line 64, in verify_password
    return verify_secret(hash, password, type)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/argon2/low_level.py", line 171, in verify_secret
    raise VerificationError(error_to_str(rv))
argon2.exceptions.VerificationError: Decoding failed

weird! I tried verify_password() lots of times in terminal. so I started to understand that what is the problem. after trying verify_password() on some argon2id hashes, I tried argon2i hash of password='a' and salt='aaaaaaaa';first time I didn't know that its because I'm using argon2id, and after I realize that, I thought that maybe the default type of varify_password() is argon2i and it gives VerificationError on other types. so I visited documentation, but I saw that verify_password(), only has hash and password parameters, not type. I tried:
verify_password(hash=(byte of argon2id hash of password='a' and salt='aaaaaaaa'),password=b'a',type=argon2.Type.ID)
in terminal. it returned True!(I really didn't expect that it will work!). so I think its better to add type parameter for verify_password() in document. and finally, please accept my apologize if I'm having any grammar, dictation,e.t.c problem, or I'm saying this in 'issues'(I'm a new user in GitHub and I'm not sure if I should say this in issue or not). and again thanks for this great module! ^_^

Unable to install on Xavier NX

Hi, I am trying to install on Nvidia Xavier NX but there is an error.
I have tried with pip install argon2-cffi and pip3 install argon2-cffi

Here is the error message.
Screenshot from 2020-11-26 16-52-30

20.1.0: pytest warnings

Just normal build, install and test cycle used on building package from non-root account:

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to setearch and sitelib inside </install/prefix>
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-argon2-cffi-20.1.0-7.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-argon2-cffi-20.1.0-7.fc35.x86_64/usr/lib/python3.8/site-packages
+ PYTHONDONTWRITEBYTECODE=1
+ /usr/bin/pytest -ra -k 'not test_repr'
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=56912300
rootdir: /home/tkloczko/rpmbuild/BUILD/argon2-cffi-20.1.0, configfile: tox.ini, testpaths: tests
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, cases-3.6.1, flaky-3.7.0, hypothesis-6.14.0, benchmark-3.4.1, xdist-2.3.0, Faker-8.8.1, pylama-7.7.1, randomly-3.8.0
collected 67 items / 1 deselected / 66 selected

tests/test_password_hasher.py .............
tests/test_low_level.py ........................
tests/test_legacy.py ..................
tests/test_utils.py ...........

============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1233
  /usr/lib/python3.8/site-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: strict

    self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")

-- Docs: https://docs.pytest.org/en/stable/warnings.html
=============================================================== 66 passed, 1 deselected, 1 warning in 4.67s ================================================================

New release

@hynek Hello again! When you get a chance, could you please trigger a new release that ships compiled wheels for Python 3.7? ๐Ÿ™

Failed Source Build on Apple Silicon

I am attempting to build argon2-cffi from source using the provided documentation. I believe the steps are as follows...

git clone [email protected]:hynek/argon2_cffi.git
git submodule init
git submodule update
python setup.py build 
pip install -e '.[dev]'

However, I run into the following error. Is there anything I can do to fix this issue? Is there a dependency that I am missing?

(base) username@User-Mac argon2-cffi % pip install --no-cache-dir -e '.[dev]'
Obtaining file:///Users/username/argon2-cffi
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/username/miniforge3/bin/python3.8 /Users/username/miniforge3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/tmp6azc3l7x
         cwd: /Users/username/argon2-cffi
    Complete output (38 lines):
    Traceback (most recent call last):
      File "/Users/username/miniforge3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
        main()
      File "/Users/username/miniforge3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/Users/username/miniforge3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 161, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 145, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 365, in <module>
        setup(
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/Users/username/miniforge3/lib/python3.8/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 423, in __init__
        _Distribution.__init__(self, {
      File "/Users/username/miniforge3/lib/python3.8/distutils/dist.py", line 292, in __init__
        self.finalize_options()
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 695, in finalize_options
        ep(self)
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 702, in _finalize_setup_keywords
        ep.load()(self, ep.name, value)
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/cffi/setuptools_ext.py", line 219, in cffi_modules
        add_cffi_module(dist, cffi_module)
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
        execfile(build_file_name, mod_vars)
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/cffi/setuptools_ext.py", line 25, in execfile
        exec(code, glob, glob)
      File "src/argon2/_ffi_build.py", line 28, in <module>
        ffi = FFI()
      File "/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/cffi/api.py", line 48, in __init__
        import _cffi_backend as backend
    ImportError: dlopen(/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/_cffi_backend.cpython-38-darwin.so, 2): no suitable image found.  Did find:
    	/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/_cffi_backend.cpython-38-darwin.so: mach-o, but wrong architecture
    	/private/var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/pip-build-env-vmy8hdop/overlay/lib/python3.8/site-packages/_cffi_backend.cpython-38-darwin.so: mach-o, but wrong architecture
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/username/miniforge3/bin/python3.8 /Users/username/miniforge3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/cl/8z0j1d3d70j98_bxh5x60z_80000gn/T/tmp6azc3l7x Check the logs for full command output.

Thank you for your help.

new argon2 release

Please vendor argon2 20161029 (1c4fc41f81f358283755eea88d4ecd05e43b7fd3). Have a look at the changelog to see what's new.

abi3 wheel idea

since you seem to be the guinea pig of abi3 and I know how much you love setup.py :)

here's an idea that lets you delete your PEP517/pip hack :D

asottile/onigurumacffi#3

let me know if you'd like me to send a PR (obvs I'd run the pre-commit hooks ๐Ÿ˜‰):

$ git diff | cat
diff --git a/setup.py b/setup.py
index e0fd787..44396b4 100644
--- a/setup.py
+++ b/setup.py
@@ -204,7 +204,10 @@ def keywords_with_side_effects(argv):
             "setup_requires": SETUP_REQUIRES,
             "cffi_modules": CFFI_MODULES,
             "libraries": LIBRARIES,
-            "cmdclass": {"build_clib": BuildCLibWithCompilerFlags},
+            "cmdclass": {
+                "bdist_wheel": BDistWheel,
+                "build_clib": BuildCLibWithCompilerFlags,
+            },
         }
 
 
@@ -331,6 +334,24 @@ class BuildCLibWithCompilerFlags(build_clib):
             )
 
 
+if (
+        sys.platform != 'win32' and
+        sys.version_info > (3,) and
+        platform.python_implementation() == 'CPython'
+):
+    try:
+        import wheel.bdist_wheel
+    except ImportError:
+        BDistWheel = None
+    else:
+        class BDistWheel(wheel.bdist_wheel.bdist_wheel):
+            def finalize_options(self) -> None:
+                self.py_limited_api = 'cp3{}'.format(sys.version_info[1])
+                wheel.bdist_wheel.bdist_wheel.finalize_options(self)
+else:
+    BDistWheel = None
+
+
 if __name__ == "__main__":
     setup(
         name=NAME,
$ pip --version
pip 20.0.2 from /tmp/argon2-cffi/venv/lib/python3.6/site-packages/pip (python 3.6)
$ pip wheel . --no-deps
Processing /tmp/argon2-cffi
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: argon2-cffi
  Building wheel for argon2-cffi (PEP 517) ... done
  Created wheel for argon2-cffi: filename=argon2_cffi-19.3.0.dev0-cp36-abi3-linux_x86_64.whl size=86910 sha256=987b258636a492e3d0eb4da9fb26882bf9af5ff9cddda55e8c7989ce99f08e62
  Stored in directory: /home/asottile/.cache/pip/wheels/ac/f2/65/3db4b7f5e358d48745b9910295753dd37080e71619eb97312d
Successfully built argon2-cffi
$ ls *.whl
argon2_cffi-19.3.0.dev0-cp36-abi3-linux_x86_64.whl

Allow to configure location of argon2 shared library and headers in setup.py

I am currently trying to package argon2_cffi for Gentoo Linux. I noticed that I am unable to build bindings against system argon2 library. Ideally, I would be able to generate Python bindings for an argon2 library that is installed on my system, instead of compiling another version of argon2.

Is there some way to point setup.py to /usr/include and /usr/lib, in order to reuse an already installed library?

Document versioning: Argon2 version 1.3 (v=19) from 2017

As discussed in Towards Practical Attacks on Argon2i and Balloon Hashing by Joel Alwen and Jeremiah Blocki, there have been significant changes to the version of Argon2 which won the Password Hashing Competition in 2015. The lastest version is 1.3, as described in the March 24, 2017 version of the Argon2 paper Argon2: the memory-hard function for password hashing and other applications by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich.

The current (2020) version of argon2-cffi implements version 1.3, as evidenced by the $v=19 (0x13) parameter in the produced hashes, but that is not documented anywhere in the repo that I've seen.

The README and the documentation should indicate which version is implemented, and document when it changes in the Changelog.

ph.hash hanging indefinitely in 18.3.0?

Setup/Issue

We deploy via a dockerfile to AWS and make rpc calls. We tracked down the issue to 18.3.0 causing our rpc calls to hang indefinitely at ph.hash(password). After forcing a revert to 18.1.0 everything works as expected. The only difference in code or dockerfile is the version of the argon2_cffi package installed.

Strangeness

We have the ability to simply call the rpc method directly in the dockerfile. Executing the method directly on the aws server through the dockerfile does not hang. Because of this I actually convinced myself that there was nothing wrong with 18.3.0. After a lot of headache I was amazed that simply isolating the version fixed our issues. I have no idea what could possibly be causing the issue. We are running inside an asyncio eventloop to make rpc calls (specifically uvloop). Not sure if that could cause the issue but seems that is the only additional puzzle piece.

Sorry we couldn't debug further. We are reverting and moving on, but figured better to raise an issue.

Installed packages

The following packages are installed in the dockerfile:

# Name                    Version                   Build  Channel
aiobotocore               0.9.4                     <pip>
aiofiles                  0.4.0                     <pip>
aiohttp                   3.4.1                     <pip>
alabaster                 0.7.11                    <pip>
argon2-cffi               18.3.0                    <pip>
asn1crypto                0.24.0                   py36_2    conda-forge
async-timeout             3.0.0                     <pip>
atomicwrites              1.1.5                    py36_0    conda-forge
attrs                     18.1.0                     py_1    conda-forge
aws-xray-sdk              0.95                      <pip>
Babel                     2.6.0                     <pip>
bcolz                     1.2.1            py36hf8a1672_1    conda-forge
blas                      1.1                    openblas    conda-forge
blosc                     1.14.4               hfc679d8_0    conda-forge
bokeh                     0.13.0                   py36_0    conda-forge
boto                      2.49.0                    <pip>
boto3                     1.7.58                     py_0    conda-forge
botocore                  1.10.58                    py_0    conda-forge
bzip2                     1.0.6                h470a237_2    conda-forge
ca-certificates           2018.8.24            ha4d7672_0    conda-forge
certifi                   2018.8.24                py36_1    conda-forge
cffi                      1.11.5           py36h5e8e0c9_1    conda-forge
chardet                   3.0.4                    py36_3    conda-forge
click                     6.7                        py_1    conda-forge
cloudpickle               0.5.3                      py_0    conda-forge
cookies                   2.2.1                     <pip>
coverage                  4.5.1            py36h470a237_1    conda-forge
cryptography              2.3              py36hdffb7b8_0    conda-forge
cryptography-vectors      2.3                      py36_1    conda-forge
cycler                    0.10.0                     py_1    conda-forge
cytoolz                   0.9.0.1          py36h470a237_0    conda-forge
dask                      0.18.2                     py_0    conda-forge
dask-core                 0.18.2                     py_0    conda-forge
dbus                      1.13.0               h3a4f0e9_0    conda-forge
decorator                 4.3.0                     <pip>
distributed               1.22.1                   py36_0    conda-forge
docker                    3.5.0                     <pip>
docker-pycreds            0.3.0                     <pip>
docutils                  0.14                     py36_0    conda-forge
ecdsa                     0.13                      <pip>
expat                     2.2.5                hfc679d8_1    conda-forge
fontconfig                2.13.0               h65d0f4c_5    conda-forge
freetype                  2.9.1                h6debe1e_0    conda-forge
future                    0.16.0                    <pip>
geocoder                  1.38.1                    <pip>
geographiclib             1.49                       py_0    conda-forge
geopy                     1.16.0                     py_0    conda-forge
gettext                   0.19.8.1                      0    conda-forge
glib                      2.55.0               h464dc38_2    conda-forge
gst-plugins-base          1.12.5               hde13a9d_0    conda-forge
gstreamer                 1.12.5               h61a6719_0    conda-forge
hdf5                      1.10.1                        2    conda-forge
heapdict                  1.0.0                    py36_0    conda-forge
httptools                 0.0.11                    <pip>
icu                       58.2                 hfc679d8_0    conda-forge
idna                      2.7                      py36_2    conda-forge
idna-ssl                  1.1.0                     <pip>
imagesize                 1.0.0                     <pip>
jinja2                    2.10                       py_1    conda-forge
jmespath                  0.9.3                      py_1    conda-forge
jpeg                      9c                   h470a237_0    conda-forge
jsondiff                  1.1.1                     <pip>
jsonpickle                0.9.6                     <pip>
kiwisolver                1.0.1            py36h2d50403_2    conda-forge
libffi                    3.2.1                hfc679d8_4    conda-forge
libgcc-ng                 7.2.0                hdf63c60_3    conda-forge
libgfortran               3.0.0                         1    conda-forge
libiconv                  1.15                 h470a237_2    conda-forge
libpng                    1.6.35               ha92aebf_0    conda-forge
libsodium                 1.0.16                        0    conda-forge
libstdcxx-ng              7.2.0                hdf63c60_3    conda-forge
libuuid                   2.32.1               h470a237_0    conda-forge
libxcb                    1.13                 h470a237_2    conda-forge
libxml2                   2.9.8                h422b904_3    conda-forge
locket                    0.2.0                      py_2    conda-forge
lzo                       2.10                          0    conda-forge
markupsafe                1.0                      py36_0    conda-forge
matplotlib                2.2.3            py36h8e2386c_0    conda-forge
mock                      2.0.0                     <pip>
more-itertools            4.2.0                    py36_1    conda-forge
moto                      1.3.5                     <pip>
msgpack-python            0.5.6            py36h2d50403_2    conda-forge
msgpack-python            0.5.6                     <pip>
multidict                 4.3.1                     <pip>
ncurses                   6.1                  hfc679d8_1    conda-forge
nose                      1.3.7                    py36_2    conda-forge
numexpr                   2.6.6                    py36_0    conda-forge
numpy                     1.15.0          py36_blas_openblashd3ea46f_200  [blas_openblas]  conda-forge
openblas                  0.2.20                        8    conda-forge
openssl                   1.0.2p               h470a237_0    conda-forge
packaging                 17.1                       py_0    conda-forge
pandas                    0.23.4           py36hf8a1672_0    conda-forge
partd                     0.3.8                      py_1    conda-forge
pathlib                   1.0.1                     <pip>
pbr                       4.2.0                     <pip>
pcre                      8.41                 h470a237_2    conda-forge
pip                       18.0                     py36_1    conda-forge
pluggy                    0.7.1                      py_0    conda-forge
psutil                    5.4.6                    py36_0    conda-forge
pthread-stubs             0.4                  h470a237_1    conda-forge
py                        1.5.4                      py_0    conda-forge
py-lz4framed              0.12.0           py36h470a237_0    conda-forge
pyaml                     17.12.1                   <pip>
pycparser                 2.18                       py_1    conda-forge
pycryptodome              3.6.6                     <pip>
Pygments                  2.2.0                     <pip>
pyjwt                     1.6.4                      py_0    conda-forge
pyopenssl                 18.0.0                   py36_0    conda-forge
pyparsing                 2.2.0                      py_1    conda-forge
pyqt                      5.6.0            py36h8210e8a_6    conda-forge
pysocks                   1.6.8                    py36_1    conda-forge
pytables                  3.4.4                    py36_8    conda-forge
pytest                    3.7.1                    py36_0    conda-forge
pytest-cov                2.5.1                      py_1    conda-forge
python                    3.6.6                h5001a0f_0    conda-forge
python-dateutil           2.7.3                      py_0    conda-forge
python-jose               2.0.2                     <pip>
python-levenshtein        0.12.0                   py36_0    conda-forge
pytz                      2018.5                     py_0    conda-forge
pyyaml                    3.12                     py36_1    conda-forge
pyzmq                     17.1.2           py36hae99301_0    conda-forge
qt                        5.6.2                hf70d934_9    conda-forge
ratelim                   0.1.6                     <pip>
readline                  7.0                  haf1bffa_1    conda-forge
requests                  2.19.1                   py36_1    conda-forge
responses                 0.9.0                     <pip>
reverse-geocoder          1.5.1                     <pip>
s3transfer                0.1.13                   py36_0    conda-forge
sanic                     0.7.0                     <pip>
Sanic-Cors                0.9.4                     <pip>
Sanic-Plugins-Framework   0.6.3.dev20180717           <pip>
scikit-learn              0.19.2          py36_blas_openblasha84fab4_201  [blas_openblas]  conda-forge
scipy                     1.1.0           py36_blas_openblash7943236_201  [blas_openblas]  conda-forge
setuptools                40.0.0                   py36_1    conda-forge
simpaauthenticate         0.5.1                     <pip>
simpaaws                  0.0.2                     <pip>
simpah5                   0.2.2                     <pip>
simpah5service            0.3.2                     <pip>
simparpc                  0.6.5                     <pip>
sip                       4.18                     py36_1    conda-forge
six                       1.11.0                   py36_1    conda-forge
snowballstemmer           1.2.1                     <pip>
sortedcontainers          2.0.4                      py_1    conda-forge
Sphinx                    1.7.6                     <pip>
sphinx-autodoc-annotation 1.0.post1                 <pip>
sphinxcontrib-websupport  1.1.0                     <pip>
sqlite                    3.24.0               h2f33b56_0    conda-forge
tblib                     1.3.2                      py_1    conda-forge
timezonefinder            3.0.1                     <pip>
tk                        8.6.8                         0    conda-forge
toolz                     0.9.0                      py_0    conda-forge
tornado                   5.1              py36h470a237_1    conda-forge
ujson                     1.35             py36h470a237_1    conda-forge
urllib3                   1.23                     py36_1    conda-forge
uvloop                    0.11.2                    <pip>
websocket-client          0.51.0                    <pip>
websockets                6.0                       <pip>
Werkzeug                  0.14.1                    <pip>
wheel                     0.31.1                   py36_1    conda-forge
wrapt                     1.10.11                   <pip>
xlrd                      1.1.0                      py_2    conda-forge
xmltodict                 0.11.0                    <pip>
xorg-libxau               1.0.8                h470a237_6    conda-forge
xorg-libxdmcp             1.1.2                h470a237_7    conda-forge
xxhash                    1.2.0                     <pip>
xz                        5.2.4                h470a237_1    conda-forge
yaml                      0.1.7                h470a237_1    conda-forge
yarl                      1.2.6                     <pip>
zeromq                    4.2.5                hfc679d8_5    conda-forge
zict                      0.1.3                      py_0    conda-forge
zlib                      1.2.11               h470a237_3    conda-forge

ModuleNotFoundError: No module named 'argon2'

I installed with pip3 install argon2-cffi but when running from argon2 import PasswordHasher, python returns ModuleNotFoundError: No module named 'argon2'
I use Python 3.8.1 with anaconda

Any idea about what I'm doing wrong ?

update vendored argon2

Could you please update the vendored argon2 C code to its latest version (i.e. 20160821 P-H-C/phc-winner-argon2@4844d2f) and release a new version of argon2_cffi? Currently it looks like that the submodule points to a random commit. Thanks.

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.