All Projects → armfazh → rfc7748_precomputed

armfazh / rfc7748_precomputed

Licence: other
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.

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
CMake
9771 projects
Makefile
30231 projects

Projects that are alternatives of or similar to rfc7748 precomputed

noble-ed25519
Fastest JS implementation of ed25519, x25519 & ristretto255. Independently audited, high-security, 0-dependency EDDSA signatures and ECDH key agreement
Stars: ✭ 220 (+411.63%)
Mutual labels:  curve25519, x25519
Kryptor
A simple, modern, and secure encryption and signing tool that aims to be a better version of age and Minisign.
Stars: ✭ 267 (+520.93%)
Mutual labels:  curve25519, x25519
rawr-x3dh
TypeScript Implementation of X3DH
Stars: ✭ 51 (+18.6%)
Mutual labels:  x25519, diffie-hellman
Rage
A simple, secure and modern encryption tool (and Rust library) with small explicit keys, no config options, and UNIX-style composability.
Stars: ✭ 826 (+1820.93%)
Mutual labels:  curve25519
WAPI
The WhatsApp API
Stars: ✭ 36 (-16.28%)
Mutual labels:  curve25519
Tweetnacl Js
Port of TweetNaCl cryptographic library to JavaScript
Stars: ✭ 1,176 (+2634.88%)
Mutual labels:  curve25519
Nsec
A modern and easy-to-use cryptographic library for .NET Core based on libsodium
Stars: ✭ 217 (+404.65%)
Mutual labels:  curve25519
monte
The bare minimum for high performance, fully-encrypted bidirectional RPC over TCP in Go with zero memory allocations.
Stars: ✭ 103 (+139.53%)
Mutual labels:  x25519
Go Ristretto
Pure Go implementation of the Ristretto prime-order group over Edwards25519
Stars: ✭ 60 (+39.53%)
Mutual labels:  curve25519
Enchive
Encrypted personal archives
Stars: ✭ 527 (+1125.58%)
Mutual labels:  curve25519
Nacl
Pure Go implementation of the NaCL set of API's
Stars: ✭ 504 (+1072.09%)
Mutual labels:  curve25519
Illustrated Tls13
The Illustrated TLS 1.3 Connection: Every byte explained
Stars: ✭ 372 (+765.12%)
Mutual labels:  curve25519
Halite
High-level cryptography interface powered by libsodium
Stars: ✭ 933 (+2069.77%)
Mutual labels:  curve25519
Sigtool
Ed25519 signing, verification and encryption, decryption for arbitary files; like OpenBSD signifiy but with more functionality and written in Golang - only easier and simpler
Stars: ✭ 49 (+13.95%)
Mutual labels:  curve25519
Curve25519 Dalek
A pure-Rust implementation of group operations on Ristretto and Curve25519
Stars: ✭ 477 (+1009.3%)
Mutual labels:  curve25519
Cryptography-Guidelines
Guidance on implementing cryptography as a developer.
Stars: ✭ 15 (-65.12%)
Mutual labels:  x25519
Nginx Autoinstall
Compile Nginx from source with custom modules on Debian and Ubuntu
Stars: ✭ 443 (+930.23%)
Mutual labels:  curve25519
Sodium compat
Pure PHP polyfill for ext/sodium
Stars: ✭ 736 (+1611.63%)
Mutual labels:  curve25519
Computer-Security-algorithms
👨‍💻 Computer Security algorithms in C#
Stars: ✭ 48 (+11.63%)
Mutual labels:  diffie-hellman
X25519 Dalek
X25519 elliptic curve Diffie-Hellman key exchange in pure-Rust, using curve25519-dalek.
Stars: ✭ 179 (+316.28%)
Mutual labels:  curve25519

How to (pre-)compute a ladder

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.

This source code is part of the research work titled: "How to (pre-)compute a ladder" by the authors:


Research Resources

A peer-reviewed paper was presented in the 24th Annual Conference on Selected Areas in Cryptography (SAC2017).

To cite this work use:

@inproceedings{oliveira_sac2017,
    author    = {Thomaz Oliveira and Julio L\'opez and
                 H\"useyin H{\i}\c{s}{\i}l and Armando Faz-Hern\'andez and
                 Francisco Rodr\'iguez-Henr\'iquez},
    editor    = {Adams, Carlisle and Camenisch, Jan},
    title     = {How to (pre-)compute a ladder},
    booktitle = {Selected Areas in Cryptography – SAC 2017:
                 24th International Conference, Ottawa, Ontario,
                 Canada, August 16 - 18, 2017, Revised Selected Papers},
    year      = {2018},
    publisher = {Springer International Publishing},
    pages     = {172-191},
    doi       = {10.1007/978-3-319-72565-9_9},
}

Implementation Details

  • Prime field arithmetic is optimized for the 4th and 6th generation of Intel Core processors (Haswell and Skylake micro-architectures).
  • Efficient integer multiplication using MULX instruction.
  • Integer additions accelerated with ADCX/ADOX instructions.
  • Key generation uses a read-only table of 8 KB (25 KB) for X25519 (X448).
  • It follows secure coding countermeasures.

Pre-requirements

This library is a standalone C-language code. However, for tests we use C++ code.

  • C and C++ compilers.
  • git
  • cmake

Compilation

First, clone the repository and configure project using the CMake tool:

 $ git clone https://github.com/armfazh/rfc7748_precomputed
 $ cd rfc7748_precomputed
 $ mkdir build
 $ cd build

To specify an alternative C/C++ compiler set the following variables:

 $ CC=gcc CXX=g++ cmake ..

Also, to specify a custom install directory (install_dir) use:

 $ cmake -DCMAKE_INSTALL_PREFIX=install_dir ..

Finally, compile and install:

 $ make
 $ make install (optional)

Running Companion Programs

Once compilation was done, you can run some companion programs.

For running a sample program use:

 $ bin/sample_x25519
 $ bin/sample_x448

For running a performance benchmark (in clock cycles) use:

 $ make bench
 $ bin/bench

For running the Google benchmark tool use:

 $ make gbench
 $ bin/gbench --benchmark_repetitions=10 --benchmark_display_aggregates_only=true

For running the Google Test tool use:

 $ make tests
 $ bin/tests

Fuzzing Test

In 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.


Timings

Benchmark performance on 64-bit Intel architectures (table entries are clock cycles).

X25519 Haswell Skylake
Key Generation 92,400 69,500
Shared Secret 145,800 108,700
X448 Haswell Skylake
Key Generation 401,902 322,040
Shared Secret 670,747 528,470

Haswell is a Core i7-4770 processor.

Skylake is a Core i7-6700K processor.


License

BSD-3 Clause License (LICENSE)


Contact

To report some issues or comments of this project, please use the issues webpage [here].


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].