{"id":16556322,"url":"https://github.com/miraclx/xstrip-auth","last_synced_at":"2026-05-28T13:06:10.714Z","repository":{"id":97679955,"uuid":"187962729","full_name":"miraclx/xstrip-auth","owner":"miraclx","description":"Cryptographically strong pseudorandom key generator based on the `XStrip Algorithm`","archived":false,"fork":false,"pushed_at":"2019-05-28T00:52:46.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-11T06:28:51.762Z","etag":null,"topics":["cipher","cryptography","encrypt","pbkdf2withhmacsha512","pseudorandom"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miraclx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-22T04:27:25.000Z","updated_at":"2020-06-20T02:24:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2a94c4e-5d66-4a53-95a8-6ce807be0708","html_url":"https://github.com/miraclx/xstrip-auth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/miraclx/xstrip-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Fxstrip-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Fxstrip-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Fxstrip-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Fxstrip-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miraclx","download_url":"https://codeload.github.com/miraclx/xstrip-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miraclx%2Fxstrip-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33609317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cipher","cryptography","encrypt","pbkdf2withhmacsha512","pseudorandom"],"created_at":"2024-10-11T20:04:11.199Z","updated_at":"2026-05-28T13:06:10.678Z","avatar_url":"https://github.com/miraclx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xstrip-auth\n\n\u003e 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### \u003ca id=\"xstripkey\"\u003e\u003c/a\u003e Class: `XStripKey`(hash, salt[, iterations][, hf])\n\n* `hash`: \u0026lt;bytes\u0026gt; The key, final content to be encapsulated by the instance\n* `salt`: \u0026lt;bytes\u0026gt; The salt used to intensify the operation\n* `iterations`: \u0026lt;number\u0026gt; Number of iterations undergone to generate the `hash`. Default: **`100000`**\n* `hf`: \u0026lt;string\u0026gt; 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`\u003csub\u003e(getter)\u003c/sub\u003e\n\nShows the encapsulated key in byte hex format\n\n#### XStripKey::`hf`\u003csub\u003e(getter)\u003c/sub\u003e\n\nReturns the hash function of the key\n\n#### XStripKey::`salt`\u003csub\u003e(getter)\u003c/sub\u003e\n\nReturns the salt of the key in bytes\n\n#### XStripKey::`iterations`\u003csub\u003e(getter)\u003c/sub\u003e\n\nReturns the number of iterations used in encoding the key\n\n#### \u003ca id=\"xstripkey_verify\"\u003e\u003c/a\u003e XStripKey::`verify`(key[, encoder])\n\n* `key`: \u0026lt;string\u0026gt;\n* `encoder`: \u0026lt;function\u0026gt;\n\nReturns: \u0026lt;boolean\u0026gt;\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#### \u003ca id=\"xstripkey_matchexec\"\u003e\u003c/a\u003e XStripKey::`matchExec`(key, fn[, *args][, encoder])\n\n* `key`: \u0026lt;string\u0026gt;\n* `fn`: \u0026lt;function\u0026gt;\n* `*args`: \u0026lt;any\u0026gt;\n* `encoder`: \u0026lt;function\u0026gt;\n\nReturns: \u0026lt;any\u0026gt;\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#### \u003ca id=\"xstripkey_mismatchexec\"\u003e\u003c/a\u003e XStripKey::`mismatchExec`(key, fn[, *args][, encoder])\n\n* `key`: \u0026lt;string\u0026gt;\n* `fn`: \u0026lt;function\u0026gt;\n* `*args`: \u0026lt;any\u0026gt;\n* `encoder`: \u0026lt;function\u0026gt;\n\nReturns: \u0026lt;any\u0026gt;\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#### \u003ca id=\"xstripkey_codes\"\u003e\u003c/a\u003e XStripKey::`codes`()\n\nReturns the octal representation of each character in a list\n\n#### \u003ca id=\"xstripkey_export\"\u003e\u003c/a\u003e 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#### \u003ca id=\"xstripkey_parse\"\u003e\u003c/a\u003e XStripKey.`parse`(content)\n\n* `fn`: \u0026lt;string | bytes\u0026gt; The exported construct to be parsed\n\nReturns: \u0026lt;[XStripKey](#xstripkey)\u0026gt;\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### \u003ca id=\"xstripkeyconstruct\"\u003e\u003c/a\u003e Class: `XStripKeyConstruct`(key[, iterations])\n\n* `key`: \u0026lt;string | bytes\u0026gt; The key to be constructed on\n* `iterations`: \u0026lt;number\u0026gt; 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#### \u003ca id=\"xstripkeyconstruct_generatekey\"\u003e\u003c/a\u003e XStripKey::`generateKey`([hf][, salt][, encoder])\n\n* `hf`: \u0026lt;string\u0026gt; The hash function to process the key on. Default: **`'sha256'`**\n* `salt`: \u0026lt;string | bytes\u0026gt; The hash to be used on the key when randomising the data. Default: [**\u003cpy:os/random\u003e**][pyosrandom]\n* `encoder`: \u0026lt;function\u0026gt; The middleware transformative function. Default: **noop**\n\nReturns: \u0026lt;[XStripKey](#xstripkey)\u0026gt;\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] © **Miraculous Owonubi** ([@miraclx][author-url]) \u0026lt;omiraculous@gmail.com\u0026gt;\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\u0026label=xstrip-auth\u0026style=popout-square\n[license-image]: https://img.shields.io/pypi/l/xstrip-auth.svg?color=green\u0026label=License\u0026style=popout-square\n[version-image]: https://img.shields.io/pypi/pyversions/xstrip-auth.svg?color=blue\u0026label=PythonVersion\u0026style=popout-square\n\n[pyosrandom]: https://pypi.org/project/xstrip-auth\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiraclx%2Fxstrip-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiraclx%2Fxstrip-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiraclx%2Fxstrip-auth/lists"}