{ "info": { "author": "Sundar Nagarajan", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "pymultikdf\n==========\n\n| This python module provides wrappers for C functions implementing the\n| following Key Derivation Functions (KDF)s:\n\n- PBKDF2\n- bcrypt\n- scrypt\n\nWhat is a Key Derivation Function?\n----------------------------------\n\nFrom wikipedia (https://en.wikipedia.org/wiki/Key_derivation_function):\n\nIn cryptography, a key derivation function (or KDF) derives one or more\nsecret keys from a secret value such as a master key, a password, or a\npassphrase using a pseudo-random function.[1][2] KDFs can be used to\nstretch keys into longer keys or to obtain keys of a required format,\nsuch as converting a group element that is the result of a\nDiffie\u2013Hellman key exchange into a symmetric key for use with AES. Keyed\ncryptographic hash functions are popular examples of pseudo-random\nfunctions used for key derivation.\n\nWhat is PBKDF2?\n~~~~~~~~~~~~~~~\n\nPBKDF2 (Password-Based Key Derivation Function 2) is a key derivation\nfunction that is part of RSA Laboratories' Public-Key Cryptography\nStandards (PKCS) series, specifically PKCS #5 v2.0, also published as\nInternet Engineering Task Force's RFC 2898. It replaces an earlier\nstandard, PBKDF1, which could only produce derived keys up to 160 bits\nlong.\n\nSee: https://en.wikipedia.org/wiki/PBKDF2\n\nWhat is bcrypt?\n~~~~~~~~~~~~~~~\n\nbcrypt is a key derivation function for passwords designed by Niels\nProvos and David Mazi\u00e8res, based on the Blowfish cipher, and presented\nat USENIX in 1999.[1] Besides incorporating a salt to protect against\nrainbow table attacks, bcrypt is an adaptive function: over time, the\niteration count can be increased to make it slower, so it remains\nresistant to brute-force search attacks even with increasing computation\npower.\n\nThe bcrypt function is the default password hash algorithm for BSD and\nother systems including some Linux distributions such as SUSE Linux.[2]\nThe prefix \"$2a$\" or \"$2b$\" (or \"$2y$\") in a hash string in a shadow\npassword file indicates that hash string is a bcrypt hash in modular\ncrypt format.[3] The rest of the hash string includes the cost\nparameter, a 128-bit salt (base-64 encoded as 22 characters), and 184\nbits of the resulting hash value (base-64 encoded as 31 characters).[4]\nThe cost parameter specifies a key expansion iteration count as a power\nof two, which is an input to the crypt algorithm.\n\nSee: https://en.wikipedia.org/wiki/Bcrypt\n\nWhat is scrypt?\n~~~~~~~~~~~~~~~\n\nIn cryptography, scrypt is a password-based key derivation function\ncreated by Colin Percival, originally for the Tarsnap online backup\nservice.[1] The algorithm was specifically designed to make it costly to\nperform large-scale custom hardware attacks by requiring large amounts\nof memory. In 2012, the scrypt algorithm was published by IETF as an\nInternet Draft, intended to become an informational RFC.[2]\n\nSee: https://en.wikipedia.org/wiki/Scrypt\n\nRelationship to existing packages\n=================================\n\nExisting python packages for PBKDF2, bcrypt, scrypt\n\n- pip install fastpbkdf2\n- pip install bcrypt\n- pip install scrypt\n\nWhy a new module?\n-----------------\n\nSometimes one wants to try or use MULTIPLE different Key Derivation\nFunctions. In such cases, instead of installing MULTIPLE SEPARATE\npython, packages, just this single module can be installed and used.\n\nThis may also be a convenience when porting your code to run under\n'Python For Android (https://github.com/kivy/python-for-android)\n\nAre there any differences?\n--------------------------\n\nExactly and ONLY the following C functions have been wrapped\n\nFrom fastpbkdf2:\n\n::\n\n fastpbkdf2_hmac_sha1\n fastpbkdf2_hmac_sha256\n fastpbkdf2_hmac_sha512\n\nFrom bcrypt:\n\n::\n\n bcrypt_kdf\n\nFrom scrypt:\n\n::\n\n crypto_scrypt\n\nThe following methods should be exactly equivalent to the corresponding\nmethods in the existing python wrappers:\n\n::\n\n ---------------------------------------------------------------\n Module.method Identical to\n ---------------------------------------------------------------\n multikdf.fastpbkdf2.pbkdf2_hmac fastpbkdf2.pbkdf2_hmac\n multikdf.bcrypt.kdf bcrypt.kdf\n multikdf.scrypt.hash scrypt.hash\n ---------------------------------------------------------------\n\nTest code\n=========\n\nSee multikdf.test (test.py under the multikdf module directory)\n\n.. code:: python\n\n import os\n from .fastpbkdf2 import pbkdf2, algorithm as hash_algorithms\n from .bcrypt import bcrypt_kdf\n from .scrypt import scrypt_kdf\n\n min_passwd_len = 8\n max_passwd_len = 10\n\n min_pbkdf_rounds = 1000\n max_pbkdf_rounds = 5000\n step_pbkdf_rounds = 200\n\n min_bcrypt_rounds = 2\n max_bcrypt_rounds = 8\n\n min_scrypt_r = 7\n max_scrypt_r = 8\n min_scrypt_p = 1\n max_scrypt_p = 2\n min_scrypt_n = 13\n max_scrypt_n = 14\n\n def test_pbkdf2(s):\n for l in range(min_passwd_len, max_passwd_len + 1):\n i = os.urandom(l)\n for r in range(min_pbkdf_rounds,\n max_pbkdf_rounds + 1,\n step_pbkdf_rounds):\n for h in hash_algorithms.keys():\n print('Testing pbkdf2: l=%d, r=%d, h=%s' % (l, r, h))\n pbkdf2(i, s, r=r, kl=kl, h=h)\n\n def test_bcrypt(s):\n for l in range(min_passwd_len, max_passwd_len + 1):\n i = os.urandom(l)\n for r in range(min_bcrypt_rounds, max_bcrypt_rounds + 1):\n print('Testing bcrypt: l=%d, r=%d' % (l, r))\n bcrypt_kdf(i, s, r=r, kl=kl)\n\n def test_scrypt(s):\n for l in range(min_passwd_len, max_passwd_len + 1):\n i = os.urandom(l)\n for r in range(min_scrypt_r, max_scrypt_r + 1):\n for p in range(min_scrypt_p, max_scrypt_p + 1):\n for n in range(min_scrypt_n, max_scrypt_n + 1):\n print('Testing scrypt: l=%d, r=%d, p=%d, n=%d' % (\n l, r, p, n))\n scrypt_kdf(i, s, r=r, p=p, n=n, kl=kl)\n\n s = os.urandom(64)\n kl = 64\n\n test_pbkdf2(s)\n test_bcrypt(s)\n test_scrypt(s)\n\nINSTALLING:\n===========\n\nFrom github directly using pip:\n\n::\n\n pip install 'git+https://github.com/sundarnagarajan/pymultikdf.git'\n\nFrom github after downloading / cloning:\n\n::\n\n python setup.py install\n\nFrom pypi:\n\n::\n\n pip install multikdf\n\nLICENSE\n=======\n\nThe files under multikdf/c/fastpbkdf2 are from ctz and are copied\nunchanged from https://github.com/ctz/fastpbkdf2.git These files under\nthe terms of the CC0 1.0 Universal License - see the file named LICENSE\nunder multikdf/c/fastpbkdf2\n\nThe files under multikdf/c/py-bcrypt are from py-bcrypt (automatically\nexported from code.google.com/p/py-bcrypt) and imported unchanged. These\nfiles under the terms of the ISC/BSD licence. See the file named LICENSE\nunder multikdf/c/py-bcrypt\n\nThe files under multikdf/c/scrypt are from Tarsnap and are copied\nunchanged from https://github.com/Tarsnap/scrypt.git The files under\nmultikdf/c/scrypt/lib are licensed under the terms of the 2-clause BSD\nlicense. See the file named README.md under the directory\nmultikdf/c/scrypt/lib.\n\nThe files under multikdf/c/scrypt/libcperciva are licensed under the\nterms of the license specified in the file\nmultikdf/c/scrypt/libcperciva/COPYRIGHT.\n\nAll remaining files in this package are licensed under the GNU General\nPublic License version 3 or (at your option) any later version. See the\nfile LICENSE-GPLv3.txt for details of the GNU General Public License\nversion 3.\n\nDocumentation (pydoc)\n=====================\n\nPackage multikdf\n----------------\n\nPACKAGE CONTENTS\n~~~~~~~~~~~~~~~~\n\n::\n\n bcrypt\n fastpbkdf2\n libmultikdf\n scrypt\n test\n\nFUNCTIONS\n~~~~~~~~~\n\n::\n\n getbuf(l)\n\nmultikdf.fastpbkdf2\n-------------------\n\nFUNCTIONS\n~~~~~~~~~\n\n::\n\n pbkdf2(i, s, r=1000, kl=64, h='SHA512')\n i-->bytes: input data (password etc)\n s-->bytes: salt\n r-->int: rounds\n kl-->int: desired key length in bytes\n h-->str: hash function (name)\n \n Returns-->bytes:\n\n pbkdf2_hmac(h, i, s, r, kl=None)\n Should be identical to original fastpbkdf2.pbkdf2_hmac\n h-->str: hash function (name)\n i-->bytes: input data (password etc)\n s-->bytes: salt\n r-->int: rounds\n kl-->int: desired key length in bytes\n \n Returns-->bytes:\n\nDATA\n~~~~\n\n::\n\n algorithm = {'sha1': None, 'sha256': None, 'sha512': None}\n\nmultikdf.bcrypt\n---------------\n\nFUNCTIONS\n~~~~~~~~~\n\n::\n\n bcrypt_kdf(i, s, r=10, kl=64)\n i-->bytes: input data (password etc)\n s-->bytes: salt (os.urandom)\n r-->int: rounds\n kl-->int: desired key length in bytes\n Returns-->bytes:\n \n (rounds * PerSec) = Machine-specific constant\n\n kdf(password, salt, desired_key_bytes, rounds)\n Should be identical to original bcrypt.kdf\n password-->bytes: input data (password etc)\n salt-->bytes: salt\n desired_key_bytes-->int: desired key length in bytes\n rounds-->int: rounds\n \n Returns-->bytes:\n\nmultikdf.scrypt\n---------------\n\nFUNCTIONS\n~~~~~~~~~\n\n::\n\n hash(i, s, N=16384, r=8, p=1, buflen=64)\n Should be identical to scrypt.hash\n i-->bytes: input data (password etc)\n s-->bytes: salt\n N-->int: General work factor. Should be a power of 2\n if N < 2, it is set to 2. Defaults to 16384\n r-->int: Memory cost - defaults to 8\n p-->int: Compuation (parallelization) cost - defaults to 1\n buflen-->int: Desired key length in bytes\n Returns-->bytes:\n\n scrypt_kdf(i, s, r=8, p=1, n=14, kl=64)\n i-->bytes: input data (password etc)\n s-->bytes: salt (os.urandom)\n r-->int: Memory cost - defaults to 8\n p-->int: Compuation (parallelization) cost - defaults to 1\n n-->int: General work factor. passed to scrypt as 2^n\n if n < 1, it is set to 1. Defaults to 14 (scrypt n=16384)\n Returns-->bytes:\n \n (r * p) should be < 2^30\n see pydoc scrypt.hash\n \n (2^n) * r * p * PerSec = Machine-specific constant", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/sundarnagarajan/pymultikdf/tree/0.01.32", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sundarnagarajan/pymultikdf", "keywords": null, "license": "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "maintainer": null, "maintainer_email": null, "name": "multikdf", "package_url": "https://pypi.org/project/multikdf/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/multikdf/", "project_urls": { "Download": "https://github.com/sundarnagarajan/pymultikdf/tree/0.01.32", "Homepage": "https://github.com/sundarnagarajan/pymultikdf" }, "release_url": "https://pypi.org/project/multikdf/0.01.32/", "requires_dist": null, "requires_python": null, "summary": "multikdf", "version": "0.01.32" }, "last_serial": 2339112, "releases": { "0.01.30": [ { "comment_text": "", "digests": { "md5": "43848ff27a7b4a21a44485d40c87e764", "sha256": "5d5237aee5849a5c31e911f43315424bb71cbc0590ff553a6881758b0d83ae66" }, "downloads": -1, "filename": "multikdf-0.01.30.tar.gz", "has_sig": false, "md5_digest": "43848ff27a7b4a21a44485d40c87e764", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 115132, "upload_time": "2016-03-27T00:42:32", "url": "https://files.pythonhosted.org/packages/b4/dc/89eb4985ac35c4bf3dd05966134c5a37d6be8f1a81b71710919e033edc3b/multikdf-0.01.30.tar.gz" } ], "0.01.31": [ { "comment_text": "", "digests": { "md5": "15a66750ba54910982d0c73ddecaaa13", "sha256": "3352568613e5944af2bd07841b9598efca3d13145c31f2e6291fc8788c004089" }, "downloads": -1, "filename": "multikdf-0.01.31.tar.gz", "has_sig": false, "md5_digest": "15a66750ba54910982d0c73ddecaaa13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 115174, "upload_time": "2016-03-27T01:24:44", "url": "https://files.pythonhosted.org/packages/3d/4a/9df94d640edcd15ea9e4dbeac507e9907e809e01d3e5a54d2fbc83eb01bc/multikdf-0.01.31.tar.gz" } ], "0.01.32": [ { "comment_text": "", "digests": { "md5": "e064e7b957249d4e6935e2a6ab0e2d1b", "sha256": "6cab044ca77392d09a018fcc1b54442072e5e314cca3d78386b29c35ba0d9778" }, "downloads": -1, "filename": "multikdf-0.01.32.tar.gz", "has_sig": false, "md5_digest": "e064e7b957249d4e6935e2a6ab0e2d1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 115185, "upload_time": "2016-09-12T23:04:25", "url": "https://files.pythonhosted.org/packages/68/79/88dadb68bb1b2fdf9ca02ffad12182fff8771b48979ad145441f90d7b72c/multikdf-0.01.32.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e064e7b957249d4e6935e2a6ab0e2d1b", "sha256": "6cab044ca77392d09a018fcc1b54442072e5e314cca3d78386b29c35ba0d9778" }, "downloads": -1, "filename": "multikdf-0.01.32.tar.gz", "has_sig": false, "md5_digest": "e064e7b957249d4e6935e2a6ab0e2d1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 115185, "upload_time": "2016-09-12T23:04:25", "url": "https://files.pythonhosted.org/packages/68/79/88dadb68bb1b2fdf9ca02ffad12182fff8771b48979ad145441f90d7b72c/multikdf-0.01.32.tar.gz" } ] }