Code Monkey home page Code Monkey logo

crypto-benchmark's Introduction

Mumble's crypto benchmark

Crypto benchmark is a tool for benchmarking modern AEAD algorithms.

Motivation

Due to the use of the old AES-128-OCB algorithm and its slow implementation in Mumble, we decided to determine the best cipher and library for the VoIP communicator.

Result Snapshot (2024, GitHub Actions)

$ ./build/crypto_benchmark
[NSS] running AES-256-GCM benchmark...
nss_encrypt(): PK11_Encrypt() failed with error -8190
[NSS] encryption failed!
[NSS] decrypted message doesn't match original, encryption/decryption failure!
[NSS] running ChaCha20-Poly1305 benchmark...
[NSS] 7.172393 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running AES-256-GCM benchmark...
[OpenSSL] 2.525026 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running AES-256-OCB benchmark...
[OpenSSL] 1.819613 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running ChaCha20-Poly1305 benchmark...
[OpenSSL] 4.273006 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AEGIS-128L benchmark...
[libsodium] 0.647157 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AEGIS-256 benchmark...
[libsodium] 1.020494 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AES-256-GCM benchmark...
[libsodium] 4.991140 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running ChaCha20-Poly1305 benchmark...
[libsodium] 6.304524 seconds for 1000000 iterations, 4096 bytes message
[wolfCrypt] running AES-256-GCM benchmark...
[wolfCrypt] Iteration 154518/1000000 (15%), elapsed time: 10.001149
[wolfCrypt] Iteration 309435/1000000 (30%), elapsed time: 20.002294
[wolfCrypt] Iteration 463682/1000000 (46%), elapsed time: 30.003333
[wolfCrypt] Iteration 617833/1000000 (61%), elapsed time: 40.004157
[wolfCrypt] Iteration 772525/1000000 (77%), elapsed time: 50.005194
[wolfCrypt] Iteration 926175/1000000 (92%), elapsed time: 60.006379
[wolfCrypt] 64.802514 seconds for 1000000 iterations, 4096 bytes message
[wolfCrypt] running ChaCha20-Poly1305 benchmark...
[wolfCrypt] Iteration 369566/1000000 (36%), elapsed time: 10.001228
[wolfCrypt] Iteration 739908/1000000 (73%), elapsed time: 20.002314
[wolfCrypt] 27.040796 seconds for 1000000 iterations, 4096 bytes message
Error: Process completed with exit code 1.

Result Snapshot (2022, Travis CI)

We build the project using Travis CI, on Ubuntu 18.04, using GCC and Clang compilers, on AMD64 and ARM64 platforms. Current status: Build Status

$ ./crypto_benchmark
[NSS] running AES-256-GCM benchmark...
[NSS] 4.007687 seconds for 1000000 iterations, 4096 bytes message
[NSS] running ChaCha20-Poly1305 benchmark...
[NSS] 32.563270 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running AES-256-GCM benchmark...
[OpenSSL] 2.398911 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running AES-256-OCB benchmark...
[OpenSSL] 2.441164 seconds for 1000000 iterations, 4096 bytes message
[OpenSSL] running ChaCha20-Poly1305 benchmark...
[OpenSSL] 4.500481 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AEGIS-128L benchmark...
[libsodium] 0.753556 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AEGIS-256 benchmark...
[libsodium] 1.144947 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running AES-256-GCM benchmark...
[libsodium] 4.243719 seconds for 1000000 iterations, 4096 bytes message
[libsodium] running ChaCha20-Poly1305 benchmark...
[libsodium] 5.813727 seconds for 1000000 iterations, 4096 bytes message
[wolfCrypt] running AES-256-GCM benchmark...
[wolfCrypt] 122.332474 seconds for 1000000 iterations, 4096 bytes message
[wolfCrypt] running ChaCha20-Poly1305 benchmark...
[wolfCrypt] 29.525731 seconds for 1000000 iterations, 4096 bytes message

Technology used

The benchmark is written in C language.

Crypto libraries

NSS, OpenSSL, libsodium (custom build from the master branch, due to AEGIS availability), wolfCrypt

Algorithm Library License Limitations
AES-256-GCM NSS MPL 2
ChaCha20-Poly1305 NSS MPL 2
AES-128-OCB OpenSSL Apache Patented
AES-256-GCM OpenSSL Apache
ChaCha20-Poly1305 OpenSSL Apache
AEGIS-128L libsodium ISC
AEGIS-256 libsodium ISC
AES-256-GCM libsodium ISC Requires SSSE3 + aesni and pclmul instructions
ChaCha20-Poly1305 libsodium ISC
AES-256-GCM wolfCrypt GPLv2 Optimizations disabled by default
ChaCha20-Poly1305 wolfCrypt GPLv2 Optimizations disabled by default

Contribute

We welcome contributions. See also our website Contribute page.

crypto-benchmark's People

Contributors

avatat avatar davidebeatrici avatar kissaki avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.