{"id":13629641,"url":"https://github.com/emp-toolkit/emp-tool","last_synced_at":"2025-04-17T09:35:47.100Z","repository":{"id":41336061,"uuid":"60801065","full_name":"emp-toolkit/emp-tool","owner":"emp-toolkit","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-21T21:26:04.000Z","size":11316,"stargazers_count":203,"open_issues_count":13,"forks_count":95,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-22T16:56:51.318Z","etag":null,"topics":["garbled-circuits","mpc","secure-computation"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emp-toolkit.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":"2016-06-09T19:25:56.000Z","updated_at":"2024-10-22T02:17:04.000Z","dependencies_parsed_at":"2024-08-01T22:36:59.711Z","dependency_job_id":null,"html_url":"https://github.com/emp-toolkit/emp-tool","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emp-toolkit%2Femp-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emp-toolkit%2Femp-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emp-toolkit%2Femp-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emp-toolkit%2Femp-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emp-toolkit","download_url":"https://codeload.github.com/emp-toolkit/emp-tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223751357,"owners_count":17196621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["garbled-circuits","mpc","secure-computation"],"created_at":"2024-08-01T22:01:15.514Z","updated_at":"2024-11-08T20:31:39.753Z","avatar_url":"https://github.com/emp-toolkit.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# emp-tool\n![arm](https://github.com/emp-toolkit/emp-tool/workflows/arm/badge.svg)\n![x86](https://github.com/emp-toolkit/emp-tool/workflows/x86/badge.svg)\n[![CodeQL](https://github.com/emp-toolkit/emp-tool/actions/workflows/codeql.yml/badge.svg)](https://github.com/emp-toolkit/emp-tool/actions/workflows/codeql.yml)\n\n\u003cimg src=\"https://raw.githubusercontent.com/emp-toolkit/emp-readme/master/art/logo-full.jpg\" width=300px/\u003e\n\n\n\n# Installation\n1. `wget https://raw.githubusercontent.com/emp-toolkit/emp-readme/master/scripts/install.py`\n2. `python install.py --deps --tool `\n    1. You can use `--ot=[release]` to install a particular branch or release\n    2. By default it will build for Release. `-DCMAKE_BUILD_TYPE=[Release|Debug]` option is also available.\n    3. No sudo? Change [`CMAKE_INSTALL_PREFIX`](https://cmake.org/cmake/help/v2.8.8/cmake.html#variable%3aCMAKE_INSTALL_PREFIX).\n\n\n# Usage\n\n## Basic Primitives\n### Pseudorandom generator\nPRG is implemented as AES-NI in the CTR mode. Usage is presented as the following code sample.\n\n```cpp\n#include\u003cemp-tool/emp-tool.h\u003e\nusing namespace emp;\nPRG prg;//using a secure random seed\n\nint rand_int, rand_ints[100];\nblock rand_block[3];\n\nprg.random_data(\u0026rand_int, sizeof(rand_int)); //fill rand_int with 32 random bits\nprg.random_block(rand_block, 3);\t      //fill rand_block with 128*3 random bits\n\nprg.reseed(\u0026rand_block[1]);                   //reset the seed and counter in prg\nprg.random_data_unaligned(rand_ints+2, sizeof(int)*98);  //when the array is not 128-bit-aligned\n```\n\n### Pseudorandom permutation\nPRP is implemented based on AES-NI. Code sample:\n```cpp\nblock key;\nPRG().random_block(\u0026key,1)\nPRP prp(key); //if no parameter is provided, a public, fixed key will be used\n\nblock rand_block[3], b3[3];\nint rand_ints[100];\n\nprp.permute_block(rand_block, 3);//applying pi on each block of data\nprp.permute_data(rand_ints, sizeof(int)*100);\n\nblock b2 = prp.H(rand_block[1], 1); //b2 = pi(r)\\xor r, where r = doubling(random_block)\\xor 1\n\nprp.H\u003c3\u003e(b3, rand_block, 0);// apply the above H on three blocks using counter 0, 1, and 2 resp.\n```\n\n### Hash function\nEssentially a wrapper of ```\u003copenssl/sha.h\u003e```\n```cpp\nHash hash;\n\nchar * data = new char[1024*1024], dig[Hash::DIGEST_SIZE];\n\nhash.put(data, 1024*1024);\nhash.digest(dig);\n```\n\n### Commitment\n```cpp\nCommitment c;\n\nchar * data = new char[1024*1024];\nCom com;\nDecom decom;\n\nc.commit(decom, com, data, 1024*1024); // commit, will fill values decom and com\nassert(c.open(decom, com, data, 1024*1024)); // open, return if the decommitment is valid or not\n```\n\n## On-the-fly Circuit Compiler\n\n\n## [Acknowledgement, Reference, and Questions](https://github.com/emp-toolkit/emp-readme/blob/master/README.md#citation)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femp-toolkit%2Femp-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femp-toolkit%2Femp-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femp-toolkit%2Femp-tool/lists"}