{"id":24076622,"url":"https://github.com/lubux/ecelgamal","last_synced_at":"2025-10-12T13:08:48.468Z","repository":{"id":86831585,"uuid":"120490712","full_name":"lubux/ecelgamal","owner":"lubux","description":"Additive homomorphic EC-ElGamal","archived":false,"fork":false,"pushed_at":"2020-10-13T00:43:16.000Z","size":1017,"stargazers_count":29,"open_issues_count":3,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T13:51:11.505Z","etag":null,"topics":["c","cryptography","homomorphic-encryption","java","secure-computation","security"],"latest_commit_sha":null,"homepage":"","language":"C","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/lubux.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":"2018-02-06T16:46:22.000Z","updated_at":"2024-07-04T02:49:38.000Z","dependencies_parsed_at":"2023-05-19T16:46:01.078Z","dependency_job_id":null,"html_url":"https://github.com/lubux/ecelgamal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubux%2Fecelgamal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubux%2Fecelgamal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubux%2Fecelgamal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lubux%2Fecelgamal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lubux","download_url":"https://codeload.github.com/lubux/ecelgamal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658609,"owners_count":21622897,"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":["c","cryptography","homomorphic-encryption","java","secure-computation","security"],"created_at":"2025-01-09T19:59:53.720Z","updated_at":"2025-10-12T13:08:43.440Z","avatar_url":"https://github.com/lubux.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EC-ElGamal\n\n[![Build status](https://travis-ci.org/lubux/ecelgamal.svg?branch=master)](https://travis-ci.org/lubux/ecelgamal)\n\nThis repository contains a C implementation of the additive homomorphic elliptic curve based EL-Gamal cryptographic scheme and a corresponding Java JNI wrapper. The elliptic curve operations of OpenSSL are used for the implementation.\nCiphertexts can be added toghether such that the decrypted result corresponds to the sum of the plaintexts (i.e. p1 + p2 = Dec(Enc(p1) ++ Enc(p2)))) similar to the Paillier-cryptosystem.\n\n\n## Content \nThe *native* folder contains the C implementation of the scheme and the *src* folder contains the Java wrapper library.\n\n### Prerequisites \nMake sure you have the following installed:\n * [CMake](https://cmake.org/)\n * [OpenSSL](http://www.openssl.org/source/)\n * [Maven](https://maven.apache.org/)\n * Java JDK 1.8\n\n### C Library\nThe C library contains two versions of EC-Elgamal, a basic version and a Chinese Remainder Thereom (CRT) based optimized version, as introduced by [Pilatus](http://www.vs.inf.ethz.ch/publ/papers/mshafagh_SenSys17_Pilatus.pdf). The library builds with cmake. To compile the library and run the benchmark run: \n\n```\ncd native\ncmake .\nmake\n./out/ecelgamal\n```\n\n\n### Java Wrapper\nThe Java library wraps the CRT based EC-ElGamal scheme implemented in C in a Java class with the JNI. The Java wrapper contains a prebuilt version of the library for linux64 and darwin64 (src/main/resources).\nTo build the jar package, maven is required. The following command builds the library:\n\n```\nmvn package\n```\nHere an example on how to use the library.\n```java\nECElGamal.CRTParams params32 = ECElGamal.getDefault32BitParams();\nECElGamal.ECElGamalKey key32 = ECElGamal.generateNewKey(params32)\nECElGamal.ECElGamalCiphertext cipher1,cipher2;\nint val1 = 2, val2 = -3;\ncipher1 = ECElGamal.encrypt(BigInteger.valueOf(val1), key32);\ncipher2 = ECElGamal.encrypt(BigInteger.valueOf(val2), key32);\ncipher1 = ECElGamal.add(cipher1, cipher2);\nint decriptedVal = ECElGamal.decrypt32(cipher1, key32);\nassertEquals(val1 + val2, decriptedVal);\n```\n\n## Performance \nOn a 256-bit curve and with an AWS EC2 micro instance in ms. (OpenSSL 1.0.2g)\n ```\nPlain EC-ElGamal 32-bit integers\nAvg ENC Time 0.238853ms Avg DEC Time 275.811 ms\n\nCRT optimized EC-ElGamal 32-bit integers\nAvg ENC Time 0.61461ms Avg DEC Time 0.339739ms \n\nCRT optimized EC-ElGamal 64-bit integers\nAvg ENC Time 1.00067ms Avg DEC Time 0.560923ms \n```\n\n## Security\nThis library is for academic purposes, gives no security guarantees and may contain implementation vulnerabilities.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flubux%2Fecelgamal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flubux%2Fecelgamal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flubux%2Fecelgamal/lists"}