{"id":37073607,"url":"https://github.com/nthparty/bfcl","last_synced_at":"2026-01-14T08:38:28.340Z","repository":{"id":40790931,"uuid":"237306017","full_name":"nthparty/bfcl","owner":"nthparty","description":"Python library for working with circuit definitions represented in the Bristol Fashion.","archived":false,"fork":false,"pushed_at":"2022-07-08T05:33:58.000Z","size":66,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T08:56:51.008Z","etag":null,"topics":["circuit","circuits","data-structures","garbled-circuits","logic-circuit","mpc","multi-party-computation","parser","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/bfcl/","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/nthparty.png","metadata":{"files":{"readme":"README.rst","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}},"created_at":"2020-01-30T21:08:01.000Z","updated_at":"2025-03-06T13:50:10.000Z","dependencies_parsed_at":"2022-09-10T10:15:22.746Z","dependency_job_id":null,"html_url":"https://github.com/nthparty/bfcl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nthparty/bfcl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthparty%2Fbfcl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthparty%2Fbfcl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthparty%2Fbfcl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthparty%2Fbfcl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nthparty","download_url":"https://codeload.github.com/nthparty/bfcl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthparty%2Fbfcl/sbom","scorecard":{"id":697695,"data":{"date":"2025-08-11","repo":{"name":"github.com/nthparty/bfcl","commit":"a1e101c98c29a2fbfb042334a3cb7794c19a0789"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/20 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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lint-test-cover-docs.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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-test-cover-docs.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/nthparty/bfcl/lint-test-cover-docs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint-test-cover-docs.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/nthparty/bfcl/lint-test-cover-docs.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/lint-test-cover-docs.yml:20","Warn: pipCommand not pinned by hash: .github/workflows/lint-test-cover-docs.yml:25","Warn: pipCommand not pinned by hash: .github/workflows/lint-test-cover-docs.yml:32","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 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":"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":"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":"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":"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":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"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 11 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-22T04:12:50.932Z","repository_id":40790931,"created_at":"2025-08-22T04:12:50.932Z","updated_at":"2025-08-22T04:12:50.932Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:31:27.429Z","status":"ssl_error","status_checked_at":"2026-01-14T08:31:19.098Z","response_time":107,"last_error":"SSL_read: 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":["circuit","circuits","data-structures","garbled-circuits","logic-circuit","mpc","multi-party-computation","parser","python"],"created_at":"2026-01-14T08:38:27.742Z","updated_at":"2026-01-14T08:38:28.333Z","avatar_url":"https://github.com/nthparty.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"====\nbfcl\n====\n\nBristol Fashion Circuit Library (BFCL) for working with circuit definitions represented using the Bristol Fashion.\n\n|pypi| |readthedocs| |actions| |coveralls|\n\n.. |pypi| image:: https://badge.fury.io/py/bfcl.svg\n   :target: https://badge.fury.io/py/bfcl\n   :alt: PyPI version and link.\n\n.. |readthedocs| image:: https://readthedocs.org/projects/bfcl/badge/?version=latest\n   :target: https://bfcl.readthedocs.io/en/latest/?badge=latest\n   :alt: Read the Docs documentation status.\n\n.. |actions| image:: https://github.com/nthparty/bfcl/workflows/lint-test-cover-docs/badge.svg\n   :target: https://github.com/nthparty/bfcl/actions/workflows/lint-test-cover-docs.yml\n   :alt: GitHub Actions status.\n\n.. |coveralls| image:: https://coveralls.io/repos/github/nthparty/bfcl/badge.svg?branch=main\n   :target: https://coveralls.io/github/nthparty/bfcl?branch=main\n   :alt: Coveralls test coverage summary.\n\nPurpose\n-------\nThis library includes data structures and associated methods for working with logical circuits typically used in secure multi-party computation (MPC) applications. The data structures follow in their organization the `Bristol Fashion \u003chttps://homes.esat.kuleuven.be/~nsmart/MPC/\u003e`_ format, extrapolating and generalizing where necessary in order to support a wider variety of features and operations.\n\nPackage Installation and Usage\n------------------------------\nThe package is available on `PyPI \u003chttps://pypi.org/project/bfcl\u003e`_::\n\n    python -m pip install bfcl\n\nThe library can be imported in the usual way::\n\n    import bfcl\n    from bfcl import *\n\nThis library makes it possible to parse a circuit definition that conforms to the Bristol Fashion syntax::\n\n    \u003e\u003e\u003e ss = ['7 36', '2 4 4', '1 1']\n    \u003e\u003e\u003e ss += ['2 1 0 1 15 AND', '2 1 2 3 16 AND']\n    \u003e\u003e\u003e ss += ['2 1 15 16 8 AND', '2 1 4 5 22 AND']\n    \u003e\u003e\u003e ss += ['2 1 6 7 23 AND', '2 1 22 23 9 AND']\n    \u003e\u003e\u003e ss += ['2 1 8 9 35 AND']\n    \u003e\u003e\u003e c = bfc('\\n'.join(ss))\n\nA string representation that conforms to the Bristol Fashion syntax can be emitted::\n\n    \u003e\u003e\u003e for line in c.emit().split('\\n'):\n\t...     print(line)\n\t...\n\t7 36\n\t2 4 4\n\t1 1\n\t2 1 0 1 15 AND\n\t2 1 2 3 16 AND\n\t2 1 15 16 8 AND\n\t2 1 4 5 22 AND\n\t2 1 6 7 23 AND\n\t2 1 22 23 9 AND\n\t2 1 8 9 35 AND\n\nIt is possible to evaluate a circuit on a sequence of input bit vectors. The circuit defined in the example above takes two 4-bit input vectors and returns the logical conjunction of all the bits. In the example below, it is evaluated on a few pairs of input bit vectors. The result is organized into a list of output bit vectors according to the original circuit definition (in the example below, the result consists of only a single output bit vector that contains a single bit)::\n\n\t\u003e\u003e\u003e c.evaluate([[1, 0, 1, 1], [1, 1, 1, 0]])\n\t[[0]]\n\t\u003e\u003e\u003e c.evaluate([[1, 1, 1, 1], [1, 1, 1, 1]])\n\t[[1]]\n\n\n.. |circuit_| replace:: ``circuit``\n.. _circuit_: https://bfcl.readthedocs.io/en/latest/_source/bfcl.html#bfcl.bfcl.circuit\n\nAs an alternative to using a string representation to define a circuit, it is also possible to construct a circuit using the `circuit \u003chttps://pypi.org/project/circuit\u003e`_ library. In the example below, the constructor for the |circuit_|_ class found in the `bfcl \u003chttps://pypi.org/project/bfcl\u003e`_ library is applied to an object built using the classes and methods exported by the `circuit \u003chttps://pypi.org/project/circuit\u003e`_ library (note the use of a synonym to avoid a conflict with the |circuit_|_ class defined in the `bfcl \u003chttps://pypi.org/project/bfcl\u003e`_ library)::\n\n\t\u003e\u003e\u003e import circuit as circuit_\n\t\u003e\u003e\u003e c = circuit_.circuit()\n\t\u003e\u003e\u003e g0 = c.gate(circuit_.op.id_, is_input=True)\n\t\u003e\u003e\u003e g1 = c.gate(circuit_.op.id_, is_input=True)\n\t\u003e\u003e\u003e g2 = c.gate(circuit_.op.and_, [g0, g1])\n\t\u003e\u003e\u003e g3 = c.gate(circuit_.op.id_, [g2], is_output=True)\n\t\u003e\u003e\u003e bfc(c).emit().split('\\n')\n\t['2 4', '1 2', '1 1', '2 1 0 1 2 AND', '1 1 2 3 LID']\n\nDocumentation\n-------------\n.. include:: toc.rst\n\nThe documentation can be generated automatically from the source files using `Sphinx \u003chttps://www.sphinx-doc.org/\u003e`_::\n\n    cd docs\n    python -m pip install -r requirements.txt\n    sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../setup.py \u0026\u0026 make html\n\nTesting and Conventions\n-----------------------\nAll unit tests are executed and their coverage is measured when using `pytest \u003chttps://docs.pytest.org/\u003e`_ (see ``setup.cfg`` for configuration details)::\n\n    python -m pip install pytest pytest-cov\n    python -m pytest\n\nAlternatively, all unit tests are included in the module itself and can be executed using `doctest \u003chttps://docs.python.org/3/library/doctest.html\u003e`_::\n\n    python bfcl/bfcl.py -v\n\nStyle conventions are enforced using `Pylint \u003chttps://www.pylint.org/\u003e`_::\n\n    python -m pip install pylint\n    python -m pylint bfcl\n\nContributions\n-------------\nIn order to contribute to the source code, open an issue or submit a pull request on the `GitHub page \u003chttps://github.com/nthparty/bfcl\u003e`_ for this library.\n\nVersioning\n----------\nBeginning with version 0.2.0, the version number format for this library and the changes to the library associated with version number increments conform with `Semantic Versioning 2.0.0 \u003chttps://semver.org/#semantic-versioning-200\u003e`_.\n\nPublishing\n----------\nThis library can be published as a `package on PyPI \u003chttps://pypi.org/project/bfcl\u003e`_ by a package maintainer. Install the `wheel \u003chttps://pypi.org/project/wheel\u003e`_ package, remove any old build/distribution files, and package the source into a distribution archive::\n\n    python -m pip install wheel\n    rm -rf dist *.egg-info\n    python setup.py sdist bdist_wheel\n\nNext, install the `twine \u003chttps://pypi.org/project/twine\u003e`_ package and upload the package distribution archive to PyPI::\n\n    python -m pip install twine\n    python -m twine upload dist/*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnthparty%2Fbfcl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnthparty%2Fbfcl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnthparty%2Fbfcl/lists"}