{"id":15717021,"url":"https://github.com/armfazh/rfc7748_precomputed","last_synced_at":"2025-10-24T03:57:15.560Z","repository":{"id":50728677,"uuid":"97239129","full_name":"armfazh/rfc7748_precomputed","owner":"armfazh","description":"Updated! (Dec2-2019) This is a C-language software library that provides optimized implementations of the Diffie-Hellman functions known as X25519 and X448 (RFC-7748) for 64-bit architectures.","archived":false,"fork":false,"pushed_at":"2023-11-10T23:56:08.000Z","size":390,"stargazers_count":44,"open_issues_count":1,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T02:02:00.107Z","etag":null,"topics":["adcx","cryptography","curve25519","diffie-hellman","ladder","mulx","rfc7748","x25519"],"latest_commit_sha":null,"homepage":"https://armfazh.github.io/publication/oliveira-lhfr-sac-2017/","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/armfazh.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":"2017-07-14T13:54:52.000Z","updated_at":"2024-08-09T09:01:34.000Z","dependencies_parsed_at":"2024-10-24T16:35:44.988Z","dependency_job_id":null,"html_url":"https://github.com/armfazh/rfc7748_precomputed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/armfazh/rfc7748_precomputed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armfazh%2Frfc7748_precomputed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armfazh%2Frfc7748_precomputed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armfazh%2Frfc7748_precomputed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armfazh%2Frfc7748_precomputed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/armfazh","download_url":"https://codeload.github.com/armfazh/rfc7748_precomputed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armfazh%2Frfc7748_precomputed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280734497,"owners_count":26381847,"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","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["adcx","cryptography","curve25519","diffie-hellman","ladder","mulx","rfc7748","x25519"],"created_at":"2024-10-03T21:48:31.551Z","updated_at":"2025-10-24T03:57:15.544Z","avatar_url":"https://github.com/armfazh.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# How to (pre-)compute a ladder\n\n\nThis is a C-language software library that provides optimized implementations of the Diffie-Hellman functions known as X25519 and X448 ([RFC-7748](https://datatracker.ietf.org/doc/rfc7748/)) for 64-bit architectures.\n\nThis source code is part of the research work titled: _\"How to (pre-)compute a ladder\"_ by the authors:\n * [Thomaz Oliveira](http://dblp.uni-trier.de/pers/hd/o/Oliveira:Thomaz), Computer Science Department, Cinvestav-IPN, Mexico.\n * [Julio López](http://www.ic.unicamp.br/pessoas/docentes/jlopez), University of Campinas, Brazil.\n * [Hüseyin Hisil](http://hhisil.yasar.edu.tr/), Yasar University, Turkey.\n * [Armando Faz-Hernández](http://www.ic.unicamp.br/~armfazh), University of Campinas, Brazil.\n * [Francisco Rodríguez-Henríquez](http://delta.cs.cinvestav.mx/~francisco/), Computer Science Department, Cinvestav-IPN, Mexico.\n\n\n----\n\n### Research Resources\n\nA peer-reviewed paper was presented in the 24th Annual Conference on Selected Areas in Cryptography ([SAC2017](http://sacworkshop.org/SAC17/SAC2017.htm)).\n - Paper [[DOI](http://doi.org/10.1007/978-3-319-72565-9_9)]\n - Slides [[PDF](http://www.ic.unicamp.br/~ra142685/userfiles/papers/oliveira_sac2017.pdf)].\n - Pre-print (IACR ePrint Archive) [http://iacr.eprint.org/2017/264](https://eprint.iacr.org/2017/264) [[PDF](https://eprint.iacr.org/2017/264.pdf)]\n\n\nTo cite this work use:\n\n```tex\n@inproceedings{oliveira_sac2017,\n    author    = {Thomaz Oliveira and Julio L\\'opez and\n                 H\\\"useyin H{\\i}\\c{s}{\\i}l and Armando Faz-Hern\\'andez and\n                 Francisco Rodr\\'iguez-Henr\\'iquez},\n    editor    = {Adams, Carlisle and Camenisch, Jan},\n    title     = {How to (pre-)compute a ladder},\n    booktitle = {Selected Areas in Cryptography – SAC 2017:\n                 24th International Conference, Ottawa, Ontario,\n                 Canada, August 16 - 18, 2017, Revised Selected Papers},\n    year      = {2018},\n    publisher = {Springer International Publishing},\n    pages     = {172-191},\n    doi       = {10.1007/978-3-319-72565-9_9},\n}\n```\n----\n\n### Implementation Details\n * Prime field arithmetic is optimized for the 4th and 6th generation of Intel Core processors (Haswell and Skylake micro-architectures).\n * Efficient integer multiplication using MULX instruction.\n * Integer additions accelerated with ADCX/ADOX instructions.\n * Key generation uses a read-only table of 8 KB (25 KB) for X25519 (X448).\n * It follows secure coding countermeasures.\n\n----\n\n### Pre-requirements\n\nThis library is a standalone C-language code. However, for tests we use C++ code.\n- C and C++ compilers.\n- git\n- cmake\n\n### Compilation\nFirst, clone the repository and configure project using the [CMake](https://cmake.org/) tool:\n\n```sh\n $ git clone https://github.com/armfazh/rfc7748_precomputed\n $ cd rfc7748_precomputed\n $ mkdir build\n $ cd build\n```\n\nTo specify an alternative C/C++ compiler set the following variables:\n\n```sh\n $ CC=gcc CXX=g++ cmake ..\n```\n\nAlso, to specify a custom install directory (`install_dir`) use:\n\n```sh\n $ cmake -DCMAKE_INSTALL_PREFIX=install_dir ..\n```\n\nFinally, compile and install:\n\n```sh\n $ make\n $ make install (optional)\n```\n\n----\n\n### Running Companion Programs\nOnce compilation was done, you can run some companion programs.\n\nFor running a sample program use:\n```sh\n $ bin/sample_x25519\n $ bin/sample_x448\n```\n\nFor running a performance benchmark (in clock cycles) use:\n```sh\n $ make bench\n $ bin/bench\n```\n\nFor running the [Google benchmark](https://github.com/google/benchmark) tool use:\n\n```sh\n $ make gbench\n $ bin/gbench --benchmark_repetitions=10 --benchmark_display_aggregates_only=true\n```\n\nFor running the [Google Test](https://github.com/google/googletest) tool use:\n\n```sh\n $ make tests\n $ bin/tests\n```\n\n#### Fuzzing Test\n\nIn the *fuzz* folder, there are several tests against  `gmp` library and the `HACL` project. Read the compilation instructions at *fuzz/README.md* for more information.\n\n----\n\n\n### Timings\nBenchmark performance on 64-bit Intel architectures (table entries are clock cycles).\n\n| X25519 | Haswell | Skylake |\n| ------ | ------:| ------:|\n| Key Generation |  92,400 |  69,500 |\n| Shared Secret  | 145,800 | 108,700 |\n\n| X448 | Haswell | Skylake |\n| ------ | ------:| ------:|\n| Key Generation | 401,902 | 322,040 |\n| Shared Secret  | 670,747 | 528,470 |\n\n**Haswell** is a Core i7-4770 processor.\n\n**Skylake** is a Core i7-6700K processor.\n\n----\n\n### License\nBSD-3 Clause License ([LICENSE](./LICENSE))\n\n----\n\n### Contact\n\nTo report some issues or comments of this project, please use the issues webpage [[here](https://github.com/armfazh/rfc7748_precomputed/issues)].\n\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmfazh%2Frfc7748_precomputed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farmfazh%2Frfc7748_precomputed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmfazh%2Frfc7748_precomputed/lists"}