{"id":13629645,"url":"https://github.com/emp-toolkit/emp-ot","last_synced_at":"2025-04-17T09:35:27.363Z","repository":{"id":9084039,"uuid":"60801935","full_name":"emp-toolkit/emp-ot","owner":"emp-toolkit","description":"Oblivious Transfer, Oblivious Transfer Extension and Variations","archived":false,"fork":false,"pushed_at":"2024-08-24T20:27:27.000Z","size":289,"stargazers_count":158,"open_issues_count":3,"forks_count":61,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-24T21:35:30.230Z","etag":null,"topics":["mpc","oblivious-transfer","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}},"created_at":"2016-06-09T19:39:03.000Z","updated_at":"2024-08-24T20:27:31.000Z","dependencies_parsed_at":"2024-01-14T06:56:14.360Z","dependency_job_id":null,"html_url":"https://github.com/emp-toolkit/emp-ot","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emp-toolkit%2Femp-ot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emp-toolkit%2Femp-ot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emp-toolkit%2Femp-ot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emp-toolkit%2Femp-ot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emp-toolkit","download_url":"https://codeload.github.com/emp-toolkit/emp-ot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223751334,"owners_count":17196615,"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":["mpc","oblivious-transfer","secure-computation"],"created_at":"2024-08-01T22:01:15.600Z","updated_at":"2024-11-08T20:31:33.518Z","avatar_url":"https://github.com/emp-toolkit.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# emp-ot \n![arm](https://github.com/emp-toolkit/emp-ot/workflows/arm/badge.svg)\n![x86](https://github.com/emp-toolkit/emp-ot/workflows/x86/badge.svg)\n[![Total alerts](https://img.shields.io/lgtm/alerts/g/emp-toolkit/emp-ot.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/emp-toolkit/emp-ot/alerts/)\n[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/emp-toolkit/emp-ot.svg?logo=lgtm\u0026logoWidth=18)](https://lgtm.com/projects/g/emp-toolkit/emp-ot/context:cpp)\n\n\u003cimg src=\"https://raw.githubusercontent.com/emp-toolkit/emp-readme/master/art/logo-full.jpg\" width=300px/\u003e\n\nProtocols\n=====\nThis repo contains state-of-the-art OT implementations. Include two base OTs, IKNP OT extension and Ferret OT extension. All hash functions used for OTs are implemented with [MiTCCR](https://github.com/emp-toolkit/emp-tool/blob/master/emp-tool/utils/mitccrh.h#L8) for optimal concrete security.\n\nInstallation\n=====\n\n1. `wget https://raw.githubusercontent.com/emp-toolkit/emp-readme/master/scripts/install.py`\n2. `python install.py --install --tool --ot`\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\nTest\n=====\n\nTesting on localhost\n-----\n\n   `./run ./bin/[binary] logn`\n\nwith `[binary]=ot` for common OT functionalities, `[binary]=ferret` for ferret specific functionalities, `logn` as the log(number of OT). The script `run` will locally open two programs.\n   \nTesting on two\n-----\n\n1. Change the IP address in the test code (e.g. [here](https://github.com/emp-toolkit/emp-ot/blob/master/test/ot.cpp))\n\n2. run `./bin/[binary] 1 [port] logn` on one machine and \n  \n   run `./bin/[binary] 2 [port] logn` on the other machine.\n  \nPerformance\n=====\nAll tested between two AWS c5.4xlarge instances.\n\n## IKNP-style protocols\n\n```\n50 Mbps\n128 NPOTs:\tTests passed.\t12577 us\nPassive IKNP OT\tTests passed.\t129262 OTps\nPassive IKNP COT\tTests passed.\t388316 OTps\nPassive IKNP ROT\tTests passed.\t386190 OTps\n128 COOTs:\tTests passed.\t11073 us\nActive IKNP OT\tTests passed.\t129152 OTps\nActive IKNP COT\tTests passed.\t387380 OTps\nActive IKNP ROT\tTests passed.\t385235 OTps\n\n10 Gbps\n128 NPOTs:\tTests passed.\t11739 us\nPassive IKNP OT\tTests passed.\t1.55476e+07 OTps\nPassive IKNP COT\tTests passed.\t2.96661e+07 OTps\nPassive IKNP ROT\tTests passed.\t1.65765e+07 OTps\n128 COOTs:\tTests passed.\t20064 us\nActive IKNP OT\tTests passed.\t1.39589e+07 OTps\nActive IKNP COT\tTests passed.\t2.42705e+07 OTps\nActive IKNP ROT\tTests passed.\t1.47379e+07 OTps\n\n```\n\n## Ferret protocols\n(unit: million random correlated OT per second)\n### Semi-honest\nbandwidth |10 Mbps|30 Mbps|50 Mbps\n------------------|-------|-------|-------\n1  thread         |12.1   |16.0   |16.0\n2 threads         |16.3   |27.0   |30.8\n3 threads         |18.3   |34.2   |40.7\n4 threads         |19.7   |39.5   |48.8\n5 threads         |20.5   |43.2   |55.0\n6 threads         |21.4   |47.1   |61.2\n\n### Malicious\nbandwidth |10 Mbps|30 Mbps|50 Mbps\n------------------|-------|-------|-------|\n1 thread          |11.6   |13.9   |13.9\n2 threads         |16.0   |26.6   |27.1\n3 threads         |18.3   |33.8   |40.0\n4 threads         |19.6   |38.3   |47.4\n5 threads         |20.4   |42.4   |53.7\n6 threads         |21.3   |46.5   |59.8\n\nUsage\n=====\nOur test files already provides useful sample code. Here we provide an overview.\n\nStandard OT\n-----\n\n```cpp\n#include\u003cemp-tool/emp-tool.h\u003e // for NetIO, etc\n#include\u003cemp-ot/emp-ot.h\u003e   // for OTs\n\nblock b0[length], b1[length];\nbool c[length];\nNetIO io(party==ALICE ? nullptr:\"127.0.0.1\", port); // Create a network with Bob connecting to 127.0.0.1\nOTNP\u003cNetIO\u003e np(\u0026io); // create a Naor Pinkas OT using the network above\nif (party == ALICE)\n// ALICE is sender, with b0[i] and b1[i] as messages to send\n    np.send(b0, b1, length); \nelse\n// Bob is receiver, with c[i] as the choice bit \n// and obtains b0[i] if c[i]==0 and b1[i] if c[i]==1\n    np.recv(b0, c, length);  \n```\nNote that `NPOT` can be replaced to `OTCO`, `IKNP`, or `FerretCOT` without changing any other part of the code. They all share the same [API](https://github.com/emp-toolkit/emp-ot/blob/master/emp-ot/ot.h)\n\n(Random) correlated OT\n-----\n\nRandom correlated OT is supported for `IKNP` and `FerretCOT`. See following as an example. They all share extra [APIs](https://github.com/emp-toolkit/emp-ot/blob/master/emp-ot/cot.h) The current interface allows specifying the Delta value once\nand get COT correlation in multiple batches.\n\n```cpp\nIKNP\u003cNetIO\u003e ote(\u0026io, false); // create a semi honest OT extension\n//Correlated OT\nif (party == ALICE)\n    ote.send_cot(b0, length); //ote.Delta is the correlation\nelse\n    ote.recv_cot(br, c, length);   //br[i] = b0[i]\\xor c[i]*ote.Delta\n    \n//Random OT\nif (party == ALICE)\n    ote.send_rot(b0, b1, length);\nelse\n    ote.recv_rot(br, c, length);    //br[i] = c[i] ? b1[i] : b0[i]\n```\n\nFerret OT\n-----\n\nFerret OT produces correlated OT with random choice bits (rcot). Extra APIs are [here](https://github.com/emp-toolkit/emp-ot/blob/master/emp-ot/ferret/ferret_cot.h). Our implementation provides two interface `ferretot.rcot()` and `ferretot.rcot_inplace()`. While the first one support filling an external array of any length, an extra memcpy is needed. The second option work on the provided array directly and thus avoid the memcpy. However, it produces a fixed number of OTs (`ferretcot-\u003en`) for every invocation. The [sample code](https://github.com/emp-toolkit/emp-ot/blob/master/test/ferret.cpp#L7) is mostly self-explainable on how to use it.\n\nNote that the choice bit is embedded to the least bit of the `block` on the receiver's side. To make sure the correlation works for all bits, the least bit of Delta is 1. This can be viewed as an extension of the point-and-permute technique. See [this code](https://github.com/emp-toolkit/emp-ot/blob/master/emp-ot/ferret/ferret_cot.hpp#L211) on how ferret is used to fullfil standard `cot` interface.\n\n```cpp\nFerretCOT\u003cNetIO\u003e ferretcot(party, threads, ios);\nif (party == ALICE)\n    ferretcot.rcot(b0, length); //ote.Delta is the correlation\nelse\n    ferretcot.rcot(br, length); //br[i] = b0[i] \\xor LSB(br[i]) * ferretcot.Delta\n```\n\nCitation\n=====\n```latex\n@misc{emp-toolkit,\n   author = {Xiao Wang and Alex J. Malozemoff and Jonathan Katz},\n   title = {{EMP-toolkit: Efficient MultiParty computation toolkit}},\n   howpublished = {\\url{https://github.com/emp-toolkit}},\n   year={2016}\n}\n```\n\nQuestion\n=====\nPlease send email to wangxiao@cs.northwestern.edu. Ferret is also developed and maintained by Chenkai Weng (ckweng@u.northwestern.edu).\n\n## Acknowledgement\nThis work was supported in part by the National Science Foundation under Awards #1111599 and #1563722. The Ferret implementation is partially based upon work supported by DARPA under Contract No. HR001120C0087. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of DARPA. The authors would also like to thank the support from PlatON Network and Facebook.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femp-toolkit%2Femp-ot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femp-toolkit%2Femp-ot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femp-toolkit%2Femp-ot/lists"}