Giter Site home page Giter Site logo

hash-speeds's Introduction

Cryptographic Hash Algorithm Benchmarks

Companion repository to this post on my blog.

Scripts to benchmark the several cryptographic hash functions using the OpenSSL speed command and generate SVGs of the results.

The hash functions are as follows:

Installation

You'll need Bundler and pipenv installed.

  1. Download the OpenSSL source code.
  2. Compile OpenSSL from source (./Configure && make).
  3. Run bundle install --without=dev to install the Ruby dependencies.
  4. Run pipenv sync to install the Python dependencies.
  5. (Optional) Install minify. sudo apt install minify. Instructions for other platforms are available here.

Example:

# install ruby dependencies
bundle install --without=dev

# install python dependencies
pipenv sync

# install minify (debian)
sudo apt install minify

Usage

  1. Set LD_LIBRARY_PATH to the OpenSSL source directory.
  2. Prepend SSL_DIR/apps to PATH.
  3. Verify that you are using the version of OpenSSL compiled in the installation instructions above using the openssl version command.
  4. Run bundle exec bin/bench.rb > results.json to run the hash write the JSON-formatted results to ./results.json.
  5. Run pipenv run bin/plot.py < ./results.json > results.svg.
  6. (Optional) Minify the SVG: minify results.svg > results.min.svg.

Example:

# set LD_LIBRARY_PATH and PATH
SSL_DIR=$HOME/src/openssl-3.0.3
export LD_LIBRARY_PATH="$SSL_DIR" PATH="$SSL_DIR/apps:$PATH"

# run benchmarks, write results to results.json
bundle exec bin/bench.rb > results.json

# generate SVG
pipenv run bin/plot.py < results.json > results.svg

# write minified SVG to results.min.svg
minify results.svg > results.min.svg

Shorter version:

# set LD_LIBRARY_PATH and PATH
SSL_DIR=$HOME/src/openssl-3.0.3
export LD_LIBRARY_PATH="$SSL_DIR" PATH="$SSL_DIR/apps:$PATH"

# run benchmarks and write SVG to "results.min.svg"
bundle exec bin/bench.rb | \
  pipenv run bin/plot.py | \
  minify --type svg > results.min.svg

Results

Example results:

x86-64 Results ARM Results

Miscellaneous

Repository contents:

  • bin/bench.rb: Run benchmarks and write results as JSON to standard output.
  • bin/plot.py: Read JSON-formatted benchmark results from standard input and write an unminified SVG to standard output.
  • bin/config.yaml: Configuration options for both scripts.
  • data/: My benchmark results.

hash-speeds's People

Contributors

pablotron avatar

Stargazers

 avatar  avatar

Watchers

 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.