{"id":32159329,"url":"https://github.com/scott-griffiths/bitstring","last_synced_at":"2026-02-22T05:35:19.663Z","repository":{"id":30240579,"uuid":"33791767","full_name":"scott-griffiths/bitstring","owner":"scott-griffiths","description":"A Python module to help you manage your bits","archived":false,"fork":false,"pushed_at":"2026-01-18T19:00:16.000Z","size":44242,"stargazers_count":444,"open_issues_count":9,"forks_count":70,"subscribers_count":12,"default_branch":"main","last_synced_at":"2026-02-18T19:11:18.869Z","etag":null,"topics":["binary-data","bit-manipulation","bitarray","bitstring","python"],"latest_commit_sha":null,"homepage":"https://bitstring.readthedocs.io/en/stable/index.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scott-griffiths.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-04-11T20:49:04.000Z","updated_at":"2026-02-17T07:39:35.000Z","dependencies_parsed_at":"2023-12-16T19:27:06.906Z","dependency_job_id":"8478cf43-1c55-4253-9a82-a11cacebca96","html_url":"https://github.com/scott-griffiths/bitstring","commit_stats":{"total_commits":797,"total_committers":14,"mean_commits":56.92857142857143,"dds":"0.43663739021329984","last_synced_commit":"c24d7ba32eec47eb11b88ca6e21c25fe43c35e18"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/scott-griffiths/bitstring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scott-griffiths%2Fbitstring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scott-griffiths%2Fbitstring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scott-griffiths%2Fbitstring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scott-griffiths%2Fbitstring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scott-griffiths","download_url":"https://codeload.github.com/scott-griffiths/bitstring/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scott-griffiths%2Fbitstring/sbom","scorecard":{"id":805368,"data":{"date":"2025-08-11","repo":{"name":"github.com/scott-griffiths/bitstring","commit":"a938a71f6247ab490a9feb274784f641c662e89d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 2/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/scott-griffiths/bitstring/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/scott-griffiths/bitstring/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:63: update your workflow using https://app.stepsecurity.io/secureworkflow/scott-griffiths/bitstring/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:105: update your workflow using https://app.stepsecurity.io/secureworkflow/scott-griffiths/bitstring/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:110: update your workflow using https://app.stepsecurity.io/secureworkflow/scott-griffiths/bitstring/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:115: update your workflow using https://app.stepsecurity.io/secureworkflow/scott-griffiths/bitstring/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:155: update your workflow using https://app.stepsecurity.io/secureworkflow/scott-griffiths/bitstring/ci.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:55","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:133","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   1 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'","Warn: branch protection not enabled for branch 'stable'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T11:37:38.414Z","repository_id":30240579,"created_at":"2025-08-23T11:37:38.414Z","updated_at":"2025-08-23T11:37:38.414Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29626608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T13:04:20.082Z","status":"ssl_error","status_checked_at":"2026-02-19T13:03:33.775Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["binary-data","bit-manipulation","bitarray","bitstring","python"],"created_at":"2025-10-21T13:02:23.785Z","updated_at":"2026-02-22T05:35:19.642Z","avatar_url":"https://github.com/scott-griffiths.png","language":"Python","readme":"\n\n![bitstring](https://raw.githubusercontent.com/scott-griffiths/bitstring/main/doc/bitstring_logo_small.png \"bitstring\")\n\n**bitstring** is a Python library to help make the creation and analysis of all types of bit-level binary data as simple and efficient as possible. It has been actively maintained since 2006.\n\nThe library has has now been downloaded over 100 million times! \u0026nbsp; \u0026nbsp; ✨ [![Pepy Total Downloads](https://img.shields.io/pepy/dt/bitstring?label=Downloads:\u0026labelColor=orange\u0026color=orange)](https://www.pepy.tech/projects/bitstring) ✨\n\n\n\n[![CI badge](https://github.com/scott-griffiths/bitstring/actions/workflows/.github/workflows/ci.yml/badge.svg)](https://github.com/scott-griffiths/bitstring/actions/workflows/ci.yml)\n[![Docs](https://img.shields.io/readthedocs/bitstring?logo=readthedocs\u0026logoColor=white)](https://bitstring.readthedocs.io/en/latest/)\n[![Codacy Badge](https://img.shields.io/codacy/grade/8869499b2eed44548fa1a5149dd451f4?logo=codacy)](https://app.codacy.com/gh/scott-griffiths/bitstring/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![Dependents (via libraries.io)](https://img.shields.io/librariesio/dependents/pypi/bitstring?logo=libraries.io\u0026logoColor=white)](https://libraries.io/pypi/bitstring)\n\u0026nbsp; \u0026nbsp;\n[![Pepy Total Downloads](https://img.shields.io/pepy/dt/bitstring?logo=python\u0026logoColor=white\u0026labelColor=blue\u0026color=blue)](https://www.pepy.tech/projects/bitstring)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/bitstring?label=%40\u0026labelColor=blue\u0026color=blue)](https://pypistats.org/packages/bitstring)\n\n----\n\n\u003e [!NOTE]\n\u003e To see what been added, improved or fixed, and also to see what's coming in the next version, see the [release notes](https://github.com/scott-griffiths/bitstring/blob/main/release_notes.md).\n\n\n# Overview\n\n* Efficiently store and manipulate binary data in idiomatic Python.\n* Create bitstrings from hex, octal, binary, files, formatted strings, bytes, integers and floats of different endiannesses.\n* Powerful binary packing and unpacking functions.\n* Bit-level slicing, joining, searching, replacing and more.\n* Create and manipulate arrays of fixed-length bitstrings.\n* Read from and interpret bitstrings as streams of binary data.\n* Rich API - chances are that whatever you want to do there's a simple and elegant way of doing it.\n* Open source software, released under the MIT licence.\n\n# Documentation\n\nExtensive documentation for the bitstring library is available.\nSome starting points are given below:\n\n* [Overview](https://bitstring.readthedocs.io/en/stable/index.html)\n* [Quick Reference](https://bitstring.readthedocs.io/en/stable/quick_reference.html)\n* [Full Reference](https://bitstring.readthedocs.io/en/stable/reference.html)\n\nThere is also an introductory walkthrough notebook on [binder](https://mybinder.org/v2/gh/scott-griffiths/bitstring/main?labpath=doc%2Fwalkthrough.ipynb).\n\n# Examples\n\n### Installation\n```\n$ pip install bitstring\n```\n\n### Creation\n```pycon\n\u003e\u003e\u003e from bitstring import Bits, BitArray, BitStream, pack\n\u003e\u003e\u003e a = BitArray(bin='00101')\n\u003e\u003e\u003e b = Bits(a_file_object)\n\u003e\u003e\u003e c = BitArray('0xff, 0b101, 0o65, uint6=22')\n\u003e\u003e\u003e d = pack('intle16, hex=a, 0b1', 100, a='0x34f')\n\u003e\u003e\u003e e = pack('\u003c16h', *range(16))\n```\n\n### Different interpretations, slicing and concatenation\n```pycon\n\u003e\u003e\u003e a = BitArray('0x3348')\n\u003e\u003e\u003e a.hex, a.bin, a.uint, a.float, a.bytes\n('3348', '0011001101001000', 13128, 0.2275390625, b'3H')\n\u003e\u003e\u003e a[10:3:-1].bin\n'0101100'\n\u003e\u003e\u003e '0b100' + 3*a\nBitArray('0x866906690669, 0b000')\n```\n\n### Reading data sequentially\n```pycon\n\u003e\u003e\u003e b = BitStream('0x160120f')\n\u003e\u003e\u003e b.read(12).hex\n'160'\n\u003e\u003e\u003e b.pos = 0\n\u003e\u003e\u003e b.read('uint12')\n352\n\u003e\u003e\u003e b.readlist('uint12, bin3')\n[288, '111']\n```\n\n### Searching, inserting and deleting\n```pycon\n\u003e\u003e\u003e c = BitArray('0b00010010010010001111')   # c.hex == '0x1248f'\n\u003e\u003e\u003e c.find('0x48')\n(8,)\n\u003e\u003e\u003e c.replace('0b001', '0xabc')\n\u003e\u003e\u003e c.insert('0b0000', pos=3)\n\u003e\u003e\u003e del c[12:16]\n```\n\n### Arrays of fixed-length formats\n```pycon\n\u003e\u003e\u003e from bitstring import Array\n\u003e\u003e\u003e a = Array('uint7', [9, 100, 3, 1])\n\u003e\u003e\u003e a.data\nBitArray('0x1390181')\n\u003e\u003e\u003e a[::2] *= 5\n\u003e\u003e\u003e a\nArray('uint7', [45, 100, 15, 1])\n```\n\n\n\u003csub\u003eCopyright (c) 2006 - 2025 Scott Griffiths\u003c/sub\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscott-griffiths%2Fbitstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscott-griffiths%2Fbitstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscott-griffiths%2Fbitstring/lists"}