{ "info": { "author": "Alex Goodman", "author_email": "alexander.goodman@jpl.nasa.gov", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "Intended Audience :: Science/Research", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Topic :: Scientific/Engineering", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Systems Administration" ], "description": "binconvert\r\n==========\r\n\r\nA CLI utility for converting byte orders in binary files from one\r\nplatform to another.\r\n\r\nIntroduction and Motivation\r\n===========================\r\n\r\n``binconvert`` is a program that was born out of the author's need to\r\nread old files that were written in a *binary* format on a SPARC system.\r\nBecause SPARC's native byte-ordering is *big endian* (ie, most\r\nsignificant byte first), this caused comptatability issues when porting\r\nthese files over to an x86 Linux machine (which has *little endian*, or\r\nleast significant byte first native byte-ordering). In an ideal world\r\nwhere the binary files are *unstructured* and every data value stored in\r\nthe file has the same type, one could easily get around this problem by\r\neither recompiling their program with special compiler flags or using\r\nsome existing CLI solutions like ``dd conv=swab``.\r\n\r\nUnfortunately there are many binary files which are *structured*, ie the\r\nvariables stored in the file are of different lengths and types, and so\r\nit becomes necessary to know the internal structure of the file\r\nbeforehand. Thankfully, python provides an easy to use ``struct`` module\r\nwhich allows for users to express the structure and byte-ordering of the\r\ndata as a format string. For example, \"f6s\" would imply that the first 4\r\nbytes in the file represent a floating point number, while the remaining\r\n6 bytes designate a 6 character string.\r\n\r\nAlthough this is a much nicer alternative than forcing the user to\r\nmanually perform the byte-swapping by hand, it can still break down when\r\nneeding to process larger binary files with more complex structures. As\r\nan example, consider a binary file named ``a.bin`` which represents the\r\nfollowing table:\r\n\r\n+--------+-----------+--------------+--------------+\r\n| Name | Age(yr) | Weight(lb) | Height(ft) |\r\n+========+===========+==============+==============+\r\n| Alex | 26 | 170.5 | 6.0 |\r\n+--------+-----------+--------------+--------------+\r\n\r\nNow imagine if this table had hundreds of additional entries. The format\r\nstring required by ``struct`` can easily become very long. However, we\r\nknow that it can be generalized as a *header* which labels each column\r\nin the table (\"4s7s10s10s\") followed by the actual entries of the table\r\n(\"4si2f\"), so it should be possible to generate the format string for an\r\narbitrary number of entries. Using ``binconvert``, without even knowing\r\nthe total size of the file beforehand, we can easily convert its\r\nbyte-ordering from big to little-endian on an x86 machine using:\r\n\r\n.. code:: sh\r\n\r\n bconv a.bin -f 4s7s10s10s 4si2f:#\r\n\r\nIn summary, ``binconvert``'s main purpose is to extend the functionality\r\nof the python ``struct`` module for these use cases by doing the following:\r\n\r\n#. Make it easier to generate format strings for larger files.\r\n#. Provide a simple CLI interface for performing the endianness\r\n conversion.\r\n\r\nInstallation and Usage\r\n======================\r\n\r\nTo install ``binconvert`` from the current codebase, you may use\r\n\r\n.. code:: sh\r\n\r\n git clone https://github.com/agoodm/binconvert.git\r\n cd binconvert\r\n python setup.py install\r\n\r\nIf all goes well, you should be able to execute the program with:\r\n\r\n.. code:: sh\r\n\r\n bconv -h\r\n\r\nIn the near future, installation methods using ``conda``\r\nwill be provided.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/agoodm/binconvert", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "binconvert", "package_url": "https://pypi.org/project/binconvert/", "platform": "any", "project_url": "https://pypi.org/project/binconvert/", "project_urls": { "Homepage": "https://github.com/agoodm/binconvert" }, "release_url": "https://pypi.org/project/binconvert/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Converts byte ordering in binary files from one platform to another", "version": "0.1.2" }, "last_serial": 2409354, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1f8462ff7fc923e155143617e37427cd", "sha256": "a8a7edd552ca628e53a593d1011bae100e4ab6a8be76ff2ba70a1f2c66595e4c" }, "downloads": -1, "filename": "binconvert-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1f8462ff7fc923e155143617e37427cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9251, "upload_time": "2016-10-18T01:39:04", "url": "https://files.pythonhosted.org/packages/df/60/804ca9913d62a9690b4df6cc965ba0070f26d3617bb8626a7b13c8a51492/binconvert-0.1.1.tar.gz" } ], "0.1.1": [], "0.1.2": [ { "comment_text": "", "digests": { "md5": "5d35e6482e4f896246250debce8efaf6", "sha256": "3be7db0888f6052fe78c887f401ed59bb5c15fc8ddd459c56a2f653837103b17" }, "downloads": -1, "filename": "binconvert-0.1.2.tar.gz", "has_sig": false, "md5_digest": "5d35e6482e4f896246250debce8efaf6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9555, "upload_time": "2016-10-18T22:39:08", "url": "https://files.pythonhosted.org/packages/5c/f7/e2b61e033420536c7b58460881f8b330e280b2e0a179020f6ae5b215f57d/binconvert-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5d35e6482e4f896246250debce8efaf6", "sha256": "3be7db0888f6052fe78c887f401ed59bb5c15fc8ddd459c56a2f653837103b17" }, "downloads": -1, "filename": "binconvert-0.1.2.tar.gz", "has_sig": false, "md5_digest": "5d35e6482e4f896246250debce8efaf6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9555, "upload_time": "2016-10-18T22:39:08", "url": "https://files.pythonhosted.org/packages/5c/f7/e2b61e033420536c7b58460881f8b330e280b2e0a179020f6ae5b215f57d/binconvert-0.1.2.tar.gz" } ] }