{ "info": { "author": "Miraculous Owonubi", "author_email": "omiraculous@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# xstrip-auth\n\n> Cryptographically strong pseudorandom key generator based on the XStrip Algorithm\n\n[![PyPI Version][pypi-image]][pypi-url]\n![License][license-image]\n![Python Version][version-image]\n\n## Installing\n\nVia [PyPI][pypi-url]:\n\n``` bash\npip install xstrip_auth\n```\n\n## Usage\n\nGenerate a 256-bit key for use\n\n``` python\nfrom xstrip_auth import XStripKeyConstruct\n\nkey = \"#P@$$W0R9\"\nconstruct = XStripKeyConstruct(key)\n\n# Creating a 16Bit key for use from the key under a md5 hash implementation\nconstruct.generateKey(hf='md5')\n# Prints\n# [md5](16): 'ec1a93e0f8d41d75ffb77914e7a31cbf'\n\n# Create a 256bit key for use from the key under the sha256 hash implementation\nconstruct.generateKey(hf='sha256')\n# Prints\n# [sha256](32): 'd6b05d17e2e15152c478825ca6e7adafd0045b0c7fd92850ead98bad0cced9a4'\n```\n\n## API\n\n### Class: `XStripKey`(hash, salt[, iterations][, hf])\n\n* `hash`: <bytes> The key, final content to be encapsulated by the instance\n* `salt`: <bytes> The salt used to intensify the operation\n* `iterations`: <number> Number of iterations undergone to generate the `hash`. Default: **`100000`**\n* `hf`: <string> Hash function used for the operation. Default: **`'sha256'`**\n\nEncapsulate a generated key within an interfacing instance for managing the inherent content\n\nThe `XStripKey` class is defined and exposed publicly by the module:\n``` python\nfrom xstrip_auth import XStripKey\n\nkey = XStripKey(bytes.fromhex('d4d64d71c71ed5365ddde126ca8e6a17301e5f9601a15119e53c2f91def21f11'),\n bytes.fromhex('422f487975c57bb648f3'))\n\nprint(key.verify(\"#P@$$W0R9\"))\n\n# Prints\n# True\n```\n\n#### XStripKey::`hex`(getter)\n\nShows the encapsulated key in byte hex format\n\n#### XStripKey::`hf`(getter)\n\nReturns the hash function of the key\n\n#### XStripKey::`salt`(getter)\n\nReturns the salt of the key in bytes\n\n#### XStripKey::`iterations`(getter)\n\nReturns the number of iterations used in encoding the key\n\n#### XStripKey::`verify`(key[, encoder])\n\n* `key`: <string>\n* `encoder`: <function>\n\nReturns: <boolean>\n\nVerify whether or not the specified `key` matches the inherent key of the [`self`](#xstripkey) instance\n`encoder` is defined by any transformers that was used used in generating the construct else, this falls back to a `noop` function that returns its parameters\nReturns a boolean for the condition result\n\n#### XStripKey::`matchExec`(key, fn[, *args][, encoder])\n\n* `key`: <string>\n* `fn`: <function>\n* `*args`: <any>\n* `encoder`: <function>\n\nReturns: <any>\n\nExecute the `fn` function if the `key` matches the inherent key of the [`self`](#xstripkey) instance by checking [`self.verify`](#xstripkey_verify)(`key`, `encoder`)\nfn is called by arguments defined in `args` (if-any)\n`encoder` is defined by any transformers that was used used in generating the construct else, this falls back to a `noop` function that returns its parameters\nReturns the return content of the function `fn`\n\n``` python\ndef fn(value):\n print(\"Password Matches, arg: %d\" % value)\n\nkey.matchExec(\"#P@$$W0R9\", fn, 10)\n\n# Prints\n# Password Matches, arg: 10\n```\n\n#### XStripKey::`mismatchExec`(key, fn[, *args][, encoder])\n\n* `key`: <string>\n* `fn`: <function>\n* `*args`: <any>\n* `encoder`: <function>\n\nReturns: <any>\n\nExecute the `fn` function if the `key` does not match the inherent key of the [`self`](#xstripkey) instance by checking [`self.verify`](#xstripkey_verify)(`key`, `encoder`)\nfn is called by arguments defined in `args` (if-any)\n`encoder` is defined by any transformers that was used used in generating the construct else, this falls back to a `noop` function that returns its parameters\nReturns the return content of the function `fn`\n\n``` python\ndef fn(value):\n print(\"Password Matches, arg: %d\" % value)\n\nkey.mismatchExec(\"something\", fn, 19)\n\n# Prints\n# Password Matches, arg: 19\n```\n\n#### XStripKey::`codes`()\n\nReturns the octal representation of each character in a list\n\n#### XStripKey::`export`()\n\nExports the entire key construct in base64 encoding parsable by [`XStripKey.parse()`](#xstripkey_parse)\n\n``` python\nprint(key.export())\n\n# Prints\n# b'MTAwMDAwOjQyMmY0ODc5NzVjNTdiYjY0OGYzL2Q0Z...OGU2YTE3MzAxZTVmOTYwMWExNTExOWU1M2MyZjkxZGVmMjFmMTE='\n```\n\n#### XStripKey.`parse`(content)\n\n* `fn`: <string | bytes> The exported construct to be parsed\nReturns: <[XStripKey](#xstripkey)>\n\nParse the base64 exported data from [`XStripKey::export`](#xstripkey_export)\n\n``` python\n\nprint(XStripKey.parse(key.export()))\nprint(key == XStripKey.parse(key.export()))\n\n# Prints\n# [sha256](32): 'd4d64d71c71ed5365ddde126ca8e6a17301e5f9601a15119e53c2f91def21f11'\n# True\n```\n\n### Class: `XStripKeyConstruct`(key[, iterations])\n\n* `key`: <string | bytes> The key to be constructed on\n* `iterations`: <number> The number of times the kdf should apply the hash function to the key in the transformative process\n\nClass to generate series of hashed keys for a single key\nMaking the product pseudorandomly secure for every use of the same key\n\nThe `XStripKey` class is defined and exposed publicly by the module:\n``` python\nfrom xstrip_auth import XStripKeyConstruct\n```\n\n#### XStripKey::`generateKey`([hf][, salt][, encoder])\n\n* `hf`: <string> The hash function to process the key on. Default: **`'sha256'`**\n* `salt`: <string | bytes> The hash to be used on the key when randomising the data. Default: [****][pyosrandom]\n* `encoder`: <function> The middleware transformative function. Default: **noop**\n\nReturns: <[XStripKey](#xstripkey)>\n\nGenerates a special key for the encapsulated key under special conditions making the product completely random and untied to the operation\nHence, generating cryptographically secure keys everytime this method is called\n`encoder` is defined by any transformers that was used used in generating the construct else, this falls back to a `noop` function that returns its parameters\n\n``` python\nconstruct = XStripKeyConstruct(\"t0y$t0ry\")\n\nconstruct.generateKey()\n # [sha256](32): '5e53edcff3bc4dc5e06b243dd206e4dbba1be625361bd2db3c9599edec217f01'\nconstruct.generateKey()\n # [sha256](32): '907d183f27a75c23830906063494ff073942e3f74d21605f7b19b16a7d94df06'\nconstruct.generateKey('md5')\n # [md5](16): 'd38518dccec4a4ef1767c01e48095a2c'\nconstruct.generateKey('sha1')\n # [sha1](20): '42f405740cd7a35a283b44c1ee0bbf0c9812015b'\n```\n\n## Development\n\n### Building\n\nFeel free to clone, use in adherance to the [license](#license) and perhaps send pull requests\n\n``` bash\ngit clone https://github.com/miraclx/xstrip-auth.git\ncd xstrip-auth\n# hack on code\npip3 install . --user\n```\n\n## License\n\n[Apache 2.0][license] \u00a9 **Miraculous Owonubi** ([@miraclx][author-url]) <omiraculous@gmail.com>\n\n[license]: LICENSE 'Apache 2.0 License'\n[author-url]: https://github.com/miraclx\n\n[pypi-url]: https://pypi.org/project/xstrip-auth\n[pypi-image]: https://img.shields.io/pypi/v/xstrip-auth.svg?color=red&label=xstrip-auth&style=popout-square\n[license-image]: https://img.shields.io/pypi/l/xstrip-auth.svg?color=green&label=License&style=popout-square\n[version-image]: https://img.shields.io/pypi/pyversions/xstrip-auth.svg?color=blue&label=PythonVersion&style=popout-square\n\n[pyosrandom]: https://pypi.org/project/xstrip-auth\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/miraclx/xstrip_auth", "keywords": "", "license": "Apache-2.0", "maintainer": "", "maintainer_email": "", "name": "xstrip-auth", "package_url": "https://pypi.org/project/xstrip-auth/", "platform": "", "project_url": "https://pypi.org/project/xstrip-auth/", "project_urls": { "Homepage": "https://github.com/miraclx/xstrip_auth" }, "release_url": "https://pypi.org/project/xstrip-auth/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Cryptographically strong pseudorandom key generator based on the XStrip Algorithm", "version": "0.2.1" }, "last_serial": 5324442, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "9381cd34c943ed2430c02b5bcea388b0", "sha256": "a67228c200a950784079e7a3cfdb1890b3226c419208a6520f411a64eabcfd1e" }, "downloads": -1, "filename": "xstrip_auth-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9381cd34c943ed2430c02b5bcea388b0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10060, "upload_time": "2019-05-28T00:42:45", "url": "https://files.pythonhosted.org/packages/8e/31/00053ade58a68dfd6c21f32722adc8f7e8d682f69be812e4fb186f0a17b1/xstrip_auth-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f0979dc0b90f9d0184dd3ef72f0bc8e9", "sha256": "d07a1deb28f8eb2f4c6838596dce4634160ae416abdfe54236fa655cf25ca5f3" }, "downloads": -1, "filename": "xstrip_auth-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f0979dc0b90f9d0184dd3ef72f0bc8e9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5215, "upload_time": "2019-05-28T00:42:50", "url": "https://files.pythonhosted.org/packages/0a/08/fca7dcca2deb0d9e98a6ecd138ad11b0b99ace421335bf036e52c166f5d7/xstrip_auth-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "02845be74eaf11ee2e4be61a264bb8d6", "sha256": "f9053c9009022faab1334e97acdecd977a5fcf66ec832e9fee4de58a10bf8f9e" }, "downloads": -1, "filename": "xstrip_auth-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "02845be74eaf11ee2e4be61a264bb8d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10063, "upload_time": "2019-05-28T00:48:18", "url": "https://files.pythonhosted.org/packages/d9/39/40c3b15de82a97396b90641f1b9a5cd7720fe3374162afe40d99eddeb1d0/xstrip_auth-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7073f666b7c72f32fcf249164006cd66", "sha256": "c070b88f37a23135585dd037cf508504e2ff2114937bda3afc2df19463c652a8" }, "downloads": -1, "filename": "xstrip_auth-0.2.1.tar.gz", "has_sig": false, "md5_digest": "7073f666b7c72f32fcf249164006cd66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5221, "upload_time": "2019-05-28T00:48:24", "url": "https://files.pythonhosted.org/packages/b8/f5/914438e68a58d7d6eb4caa9bdda49a3d759d6eb98d6c9cc2f25199d28e22/xstrip_auth-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "02845be74eaf11ee2e4be61a264bb8d6", "sha256": "f9053c9009022faab1334e97acdecd977a5fcf66ec832e9fee4de58a10bf8f9e" }, "downloads": -1, "filename": "xstrip_auth-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "02845be74eaf11ee2e4be61a264bb8d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10063, "upload_time": "2019-05-28T00:48:18", "url": "https://files.pythonhosted.org/packages/d9/39/40c3b15de82a97396b90641f1b9a5cd7720fe3374162afe40d99eddeb1d0/xstrip_auth-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7073f666b7c72f32fcf249164006cd66", "sha256": "c070b88f37a23135585dd037cf508504e2ff2114937bda3afc2df19463c652a8" }, "downloads": -1, "filename": "xstrip_auth-0.2.1.tar.gz", "has_sig": false, "md5_digest": "7073f666b7c72f32fcf249164006cd66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5221, "upload_time": "2019-05-28T00:48:24", "url": "https://files.pythonhosted.org/packages/b8/f5/914438e68a58d7d6eb4caa9bdda49a3d759d6eb98d6c9cc2f25199d28e22/xstrip_auth-0.2.1.tar.gz" } ] }