{ "info": { "author": "Chris Stranex", "author_email": "chris@stranex.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# BatteryHorse\nEncode and decode text as English sentences. The name is inspired by this [xkcd comic](https://www.xkcd.com/936/).\n\n## API\nThe batteryhorse module exposes three functions:\n\n### encode_data(data: bytes) -> str\nEncode the given data into one or more English phrases/sentences. Uses [Wordnet](https://wordnet.princeton.edu/) from the [NLTK](http://www.nltk.org/) library to create sentences in the following format: VERB NOUN ADJECTIVE CONJUNCTION ADJECTIVE. If the bytes can be encoded into fewer parts of speech then the rest will be truncated.\n\n### decode_data(data: str, length: int) -> bytes\nDecode a string of sentences or phrases back into the original bytes. Also requires the size of the output bytes\n\n### create_secret(size=3: int) -> bytes\nCreates a random passphrase by using random words from the Wordnet. Size specifies the number of words to use\n\n## Examples\nA basic example that encodes some data\n```python\n>>> import batteryhorse\n>>> batteryhorse.encode_data(b'TEST')\n'Unitise annum abasic'\n```\n\nAn example showing encoding and decoding data\n```python\n>>> from hashlib import sha1\n>>> import batteryhorse\n>>> \n>>> digest = sha1('test'.encode('utf-8')).digest()\n>>> \n>>> batteryhorse.encode_data(digest)\n'Birdnest vara lobed or orthoptic. Wow fencing orthogonal yet anthropomorphic. Scranch rifadin anosmatic'\n>>> \n>>> batteryhorse.decode_data('Birdnest vara lobed or orthoptic. Wow fencing orthogonal yet anthropomorphic. Scranch rifadin anosmatic', len(digest))\nb'\\xa9J\\x8f\\xe5\\xcc\\xb1\\x9b\\xa6\\x1cL\\x08s\\xd3\\x91\\xe9\\x87\\x98/\\xbb\\xd3'\n>>> print(digest)\nb'\\xa9J\\x8f\\xe5\\xcc\\xb1\\x9b\\xa6\\x1cL\\x08s\\xd3\\x91\\xe9\\x87\\x98/\\xbb\\xd3'\n```\n\n## Command Line\nBatteryHorse is also available on the command line.\n```\n --encode Accept data to be encoded from STDIN\n --decode Accept data to be decoded from STDIN\n --generate Generate a random secret\n --length LENGTH Specify the length of secret or data to be decoded\n```\n\nAnd as an example\n```bash\n$ echo \"TEST\" | python -m batteryhorse --encode\nBare gyrostabilizer amygdaloidal\n```\n\n## Uses\nThe original intention of this library was to create a new way of sharing fingerprints of public keys.\n\n## Limitations\nAlthough Batteryhorse can encode data of arbitary lengths it does no padding of the data beforehand resulting in some sentences that may not be complete.\n\nAdditionally, since the length of the original data is not encoded the decode function must take the length as a parameter.\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/cstranex/batteryhorse", "keywords": "", "license": "Apache License, Version 2.0", "maintainer": "", "maintainer_email": "", "name": "BatteryHorse", "package_url": "https://pypi.org/project/BatteryHorse/", "platform": "", "project_url": "https://pypi.org/project/BatteryHorse/", "project_urls": { "Homepage": "https://github.com/cstranex/batteryhorse", "Source Code": "https://github.com/cstranex/batteryhorse" }, "release_url": "https://pypi.org/project/BatteryHorse/1.0.0/", "requires_dist": [ "nltk" ], "requires_python": ">=3.4", "summary": "Encode and decode binary data to English sentences", "version": "1.0.0" }, "last_serial": 4634624, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "a64ba4e0b594b0dcacbf4d6ca54fd7ca", "sha256": "fd6e1af601b399973a085355f0202ee1e7453c141549ded7edd0a357e7e77f29" }, "downloads": -1, "filename": "BatteryHorse-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a64ba4e0b594b0dcacbf4d6ca54fd7ca", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 10793227, "upload_time": "2018-12-26T06:04:44", "url": "https://files.pythonhosted.org/packages/df/18/59d326d88c30e8505edd0dec8102ae6a742077c35fab655115717cca2dc8/BatteryHorse-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b8b99c5f1b950b3b1c4291817a5a3039", "sha256": "ae39bc68785acf7ba1b7dd91ec0a7449ee6db7dd24dbb2ee2007ed2d3cff0c47" }, "downloads": -1, "filename": "BatteryHorse-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b8b99c5f1b950b3b1c4291817a5a3039", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 10709830, "upload_time": "2018-12-26T06:04:57", "url": "https://files.pythonhosted.org/packages/a2/d2/676747c2c535a1c732fcb99e3789b794c88d2e634a3abf2bc55832ab7218/BatteryHorse-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a64ba4e0b594b0dcacbf4d6ca54fd7ca", "sha256": "fd6e1af601b399973a085355f0202ee1e7453c141549ded7edd0a357e7e77f29" }, "downloads": -1, "filename": "BatteryHorse-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a64ba4e0b594b0dcacbf4d6ca54fd7ca", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 10793227, "upload_time": "2018-12-26T06:04:44", "url": "https://files.pythonhosted.org/packages/df/18/59d326d88c30e8505edd0dec8102ae6a742077c35fab655115717cca2dc8/BatteryHorse-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b8b99c5f1b950b3b1c4291817a5a3039", "sha256": "ae39bc68785acf7ba1b7dd91ec0a7449ee6db7dd24dbb2ee2007ed2d3cff0c47" }, "downloads": -1, "filename": "BatteryHorse-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b8b99c5f1b950b3b1c4291817a5a3039", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 10709830, "upload_time": "2018-12-26T06:04:57", "url": "https://files.pythonhosted.org/packages/a2/d2/676747c2c535a1c732fcb99e3789b794c88d2e634a3abf2bc55832ab7218/BatteryHorse-1.0.0.tar.gz" } ] }