Git Product home page Git Product logo

python-fastpbkdf2's Introduction

python-fastpbkdf2

Build Status codecov.io

python-fastpbkdf2 is a set of Python bindings for fastpbkdf2 with an interface compatible with the standard library's hashlib.pbkdf2_hmac. Initial testing shows that it is about 40% faster than the standard library implementation.

python-fastpbkdf2 supports and is tested against Python versions 2.7, 3.3, 3.4, 3.5, 3.6.

Installation

python-fastpbkdf2 can be installed with pip:

pip install fastpbkdf2

python-fastpbkdf2 depends on CFFI to bind C code. libffi-dev and python-dev may be required and can be installed with various package managers such as yum or apt-get.

How to use

python-fastpbkdf2 provides an interface compatible wtih hashlib.pbkdf2_hmac. The module contains a single function that can be imported in place of hashlib.pbkdf2_hmac.

from fastpbkdf2 import pbkdf2_hmac

License

python-fastpbkdf2 is made available under both the BSD and Apache Software License Version 2.0 licenses. See the LICENSE.BSD and LICENSE.APACHE files for the exact terms of the license.

Bug reports, security issues and contributing

python-fastpbkdf2 welcomes any bug reports, fixes and suggestions. If an issue is security-sensitive, please email me directly at [email protected].

If contributing a patch, please adhere to the following guidelines:

  • Follow PEP 8. The test suite runs a flake8 lint to catch any issues.
  • Keep patches small to ease the review process. Bigger patches can be broken up in logical chunks.
  • Ensure that test coverage remains at 100%.

python-fastpbkdf2's People

Contributors

ayrx avatar felixonmars 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

python-fastpbkdf2's Issues

SOURCES.txt in latest pypi package has hardcoded temp path

image

This causes the install to break on Windows:

py -m pip install fastpbkdf2 --global-option=build_ext --global-option="-IC:\vcpkg\installed\x64-windows\include" --global-option="-LC:\vcpkg\installed\x64-windows\lib\"
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: C:\Program Files\Python39\Include\UNKNOWN
sysconfig: C:\Program Files\Python39\Include
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
Defaulting to user installation because normal site-packages is not writeable
Collecting fastpbkdf2
  Using cached fastpbkdf2-0.2.tar.gz (24 kB)
Requirement already satisfied: cffi>=1.1 in c:\users\adam\appdata\roaming\python\python39\site-packages (from fastpbkdf2) (1.14.5)
Requirement already satisfied: six>=1.4.1 in c:\program files\python39\lib\site-packages (from fastpbkdf2) (1.15.0)
Requirement already satisfied: pycparser in c:\users\adam\appdata\roaming\python\python39\site-packages (from cffi>=1.1->fastpbkdf2) (2.20)
Skipping wheel build for fastpbkdf2, due to binaries being disabled for it.
Installing collected packages: fastpbkdf2
    Running setup.py install for fastpbkdf2 ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Program Files\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Adam\\AppData\\Local\\Temp\\pip-install-9arly6v7\\fastpbkdf2_8299e04db9394692ad38fda5b39aa6a4\\setup.py'"'"'; __file__='"'"'C:\\Users\\Adam\\AppData\\Local\\Temp\\pip-install-9arly6v7\\fastpbkdf2_8299e04db9394692ad38fda5b39aa6a4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\vcpkg\installed\x64-windows\include' '-LC:\vcpkg\installed\x64-windows\lib\' install --record 'C:\Users\Adam\AppData\Local\Temp\pip-record-j2k4hvwa\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Adam\AppData\Roaming\Python\Python39\Include\fastpbkdf2'
         cwd: C:\Users\Adam\AppData\Local\Temp\pip-install-9arly6v7\fastpbkdf2_8299e04db9394692ad38fda5b39aa6a4\
    Complete output (80 lines):
    running build_ext
    generating cffi module 'build\\temp.win-amd64-3.9\\Release\\_fastpbkdf2.c'
    creating build
    creating build\temp.win-amd64-3.9
    creating build\temp.win-amd64-3.9\Release
    building '_fastpbkdf2' extension
    creating build\temp.win-amd64-3.9\Release\Users
    creating build\temp.win-amd64-3.9\Release\Users\Adam
    creating build\temp.win-amd64-3.9\Release\Users\Adam\AppData
    creating build\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local
    creating build\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local\Temp
    creating build\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local\Temp\tmpc4du0eq_
    creating build\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0
    creating build\temp.win-amd64-3.9\Release\build
    creating build\temp.win-amd64-3.9\Release\build\temp.win-amd64-3.9
    creating build\temp.win-amd64-3.9\Release\build\temp.win-amd64-3.9\Release
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0 -IC:\vcpkg\installed\x64-windows\include -IC:\Program Files\Python39\include -IC:\Program Files\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /TcC:\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0\fastpbkdf2.c /Fobuild\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0\fastpbkdf2.obj /O2 /WX /nologo
    fastpbkdf2.c
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0 -IC:\vcpkg\installed\x64-windows\include -IC:\Program Files\Python39\include -IC:\Program Files\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcbuild\temp.win-amd64-3.9\Release\_fastpbkdf2.c /Fobuild\temp.win-amd64-3.9\Release\build\temp.win-amd64-3.9\Release\_fastpbkdf2.obj /O2 /WX /nologo
    _fastpbkdf2.c
    creating C:\Users\Adam\AppData\Local\Temp\pip-install-9arly6v7\fastpbkdf2_8299e04db9394692ad38fda5b39aa6a4\build\lib.win-amd64-3.9
    creating C:\Users\Adam\AppData\Local\Temp\pip-install-9arly6v7\fastpbkdf2_8299e04db9394692ad38fda5b39aa6a4\build\lib.win-amd64-3.9\fastpbkdf2
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\vcpkg\installed\x64-windows\lib\ /LIBPATH:C:\Program Files\Python39\libs /LIBPATH:C:\Program Files\Python39\PCbuild\amd64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\lib\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64 libeay32.lib crypt32.lib advapi32.lib gdi32.lib user32.lib ws2_32.lib /EXPORT:PyInit__fastpbkdf2 build\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0\fastpbkdf2.obj build\temp.win-amd64-3.9\Release\build\temp.win-amd64-3.9\Release\_fastpbkdf2.obj /OUT:build\lib.win-amd64-3.9\fastpbkdf2\_fastpbkdf2.pyd /IMPLIB:build\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0\_fastpbkdf2.lib
       Creating library build\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0\_fastpbkdf2.lib and object build\temp.win-amd64-3.9\Release\Users\Adam\AppData\Local\Temp\tmpc4du0eq_\fastpbkdf2-1.0.0\_fastpbkdf2.exp
    Generating code
    Finished generating code
    running install
    running build
    running build_py
    copying src\fastpbkdf2\__init__.py -> build\lib.win-amd64-3.9\fastpbkdf2
    running install_lib
    copying build\lib.win-amd64-3.9\fastpbkdf2\_fastpbkdf2.pyd -> C:\Users\Adam\AppData\Roaming\Python\Python39\site-packages\fastpbkdf2
    running install_egg_info
    running egg_info
    writing src\fastpbkdf2.egg-info\PKG-INFO
    writing dependency_links to src\fastpbkdf2.egg-info\dependency_links.txt
    writing requirements to src\fastpbkdf2.egg-info\requires.txt
    writing top-level names to src\fastpbkdf2.egg-info\top_level.txt
    reading manifest file 'src\fastpbkdf2.egg-info\SOURCES.txt'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Adam\AppData\Local\Temp\pip-install-9arly6v7\fastpbkdf2_8299e04db9394692ad38fda5b39aa6a4\setup.py", line 180, in <module>
        setup(
      File "C:\Program Files\Python39\lib\site-packages\setuptools\__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "C:\Program Files\Python39\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Program Files\Python39\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Program Files\Python39\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Program Files\Python39\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Program Files\Python39\lib\distutils\command\install.py", line 558, in run
        self.run_command(cmd_name)
      File "C:\Program Files\Python39\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Program Files\Python39\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Program Files\Python39\lib\site-packages\setuptools\command\install_egg_info.py", line 34, in run
        self.run_command('egg_info')
      File "C:\Program Files\Python39\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Program Files\Python39\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Program Files\Python39\lib\site-packages\setuptools\command\egg_info.py", line 297, in run
        self.find_sources()
      File "C:\Program Files\Python39\lib\site-packages\setuptools\command\egg_info.py", line 304, in find_sources
        mm.run()
      File "C:\Program Files\Python39\lib\site-packages\setuptools\command\egg_info.py", line 535, in run
        self.add_defaults()
      File "C:\Program Files\Python39\lib\site-packages\setuptools\command\egg_info.py", line 579, in add_defaults
        self.read_manifest()
      File "C:\Program Files\Python39\lib\site-packages\setuptools\command\sdist.py", line 220, in read_manifest
        self.filelist.append(line)
      File "C:\Program Files\Python39\lib\site-packages\setuptools\command\egg_info.py", line 477, in append
        path = convert_path(item)
      File "C:\Program Files\Python39\lib\distutils\util.py", line 123, in convert_path
        raise ValueError("path '%s' cannot be absolute" % pathname)
    ValueError: path '/var/folders/pb/jv_m_p714_qgdvmkvgfqns0w0000gn/T/tmp5_dem980/fastpbkdf2-1.0.0/fastpbkdf2.c' cannot be absolute
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Adam\\AppData\\Local\\Temp\\pip-install-9arly6v7\\fastpbkdf2_8299e04db9394692ad38fda5b39aa6a4\\setup.py'"'"'; __file__='"'"'C:\\Users\\Adam\\AppData\\Local\\Temp\\pip-install-9arly6v7\\fastpbkdf2_8299e04db9394692ad38fda5b39aa6a4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\vcpkg\installed\x64-windows\include' '-LC:\vcpkg\installed\x64-windows\lib\' install --record 'C:\Users\Adam\AppData\Local\Temp\pip-record-j2k4hvwa\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Adam\AppData\Roaming\Python\Python39\Include\fastpbkdf2' Check the logs for full command output.

Unable to build

Was unable to build the by using pip install fastpbkdf2. Seems like it requires some more files than a basic install will have. Was wondering if maybe was possible add a bit more information on how to install this script as it looks pretty neat in terms of performance benefits. Thanks!

Collecting fastpbkdf2
Using cached fastpbkdf2-0.2.tar.gz
Requirement already satisfied: cffi>=1.1 in c:\python27\lib\site-packages (from fastpbkdf2)
Requirement already satisfied: six>=1.4.1 in c:\python27\lib\site-packages\six-1.10.0-py2.7.egg (from fastpbkdf2)
Requirement already satisfied: pycparser in c:\python27\lib\site-packages (from cffi>=1.1->fastpbkdf2)
Installing collected packages: fastpbkdf2
Running setup.py install for fastpbkdf2 ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\user\appdata\local\temp\pip-build-ejcufu\fastpbkdf2\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-kbravh-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\fastpbkdf2
copying src\fastpbkdf2_init_.py -> build\lib.win32-2.7\fastpbkdf2
running build_ext
generating cffi module 'build\temp.win32-2.7\Release\_fastpbkdf2.c'
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
building '_fastpbkdf2' extension
creating build\temp.win32-2.7\Release\build
creating build\temp.win32-2.7\Release\build\temp.win32-2.7
creating build\temp.win32-2.7\Release\build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\users
creating build\temp.win32-2.7\Release\users\user
creating build\temp.win32-2.7\Release\users\user\appdata
creating build\temp.win32-2.7\Release\users\user\appdata\local
creating build\temp.win32-2.7\Release\users\user\appdata\local\temp
creating build\temp.win32-2.7\Release\users\user\appdata\local\temp\tmpuytc2l
creating build\temp.win32-2.7\Release\users\user\appdata\local\temp\tmpuytc2l\fastpbkdf2-1.0.0
C:\Users\user\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\users\user\appdata\local\temp\tmpuytc2l\fastpbkdf2-1.0.0 -Ic:\python27\include -Ic:\python27\PC /Tcbuild\temp.win32-2.7\Release_fastpbkdf2.c /Fobuild\temp.win32-2.7\Release\build\temp.win32-2.7\Release_fastpbkdf2.obj /O2 /WX /nologo
_fastpbkdf2.c
c:\users\user\appdata\local\temp\tmpuytc2l\fastpbkdf2-1.0.0\fastpbkdf2.h(19) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
error: command 'C:\Users\user\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2

----------------------------------------

fastpbkdf2 still references libeay32.lib

After installing openssl via vcpkg and adding the include path via --global-option=

    LINK : fatal error LNK1181: cannot open input file 'libeay32.lib'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\link.exe' failed with exit code 1181
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files\Python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Adam\\AppData\\Local\\Temp\\pip-install-mjn4m2em\\fastpbkdf2_5608a8e98e144d17bc882be5b6a029c6\\setup.py'"'"'; __file__='"'"'C:\\Users\\Adam\\AppData\\Local\\Temp\\pip-install-mjn4m2em\\fastpbkdf2_5608a8e98e144d17bc882be5b6a029c6\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\vcpkg\installed\x64-windows\include' install --record 'C:\Users\Adam\AppData\Local\Temp\pip-record-q7eiqwow\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Adam\AppData\Roaming\Python\Python39\Include\fastpbkdf2' Check the logs for full command output.

This is now libcrypto.lib

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.