All Projects → yandex → argon2

yandex / argon2

Licence: BSD-3-Clause license
Implementation of argon2 (i, d, id) algorithms with CPU dispatching

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
shell
77523 projects

Projects that are alternatives of or similar to argon2

Hybridizer Basic Samples
Examples of C# code compiled to GPU by hybridizer
Stars: ✭ 186 (+154.79%)
Mutual labels:  avx2
SiaFpgaMiner
VHDL FPGA design of an optimized Blake2b pipeline to mine Siacoin
Stars: ✭ 58 (-20.55%)
Mutual labels:  blake2b
Guided Missile Simulation
Guided Missile, Radar and Infrared EOS Simulation Framework written in Fortran.
Stars: ✭ 33 (-54.79%)
Mutual labels:  avx2
Toys
Storage for my snippets, toy programs, etc.
Stars: ✭ 187 (+156.16%)
Mutual labels:  avx2
Sse Popcount
SIMD (SSE) population count --- http://0x80.pl/articles/sse-popcount.html
Stars: ✭ 226 (+209.59%)
Mutual labels:  avx2
monte
The bare minimum for high performance, fully-encrypted bidirectional RPC over TCP in Go with zero memory allocations.
Stars: ✭ 103 (+41.1%)
Mutual labels:  blake2b
Osaca
Open Source Architecture Code Analyzer
Stars: ✭ 162 (+121.92%)
Mutual labels:  avx2
neopo
A lightweight solution for local Particle development.
Stars: ✭ 19 (-73.97%)
Mutual labels:  argon
Boost.simd
Boost SIMD
Stars: ✭ 238 (+226.03%)
Mutual labels:  avx2
argon-dashboard-asp-net
Start your development with a Bootstrap 4 Admin Dashboard built for ASP.NET Core framework, the newest go-to technology from Microsoft for top companies.
Stars: ✭ 176 (+141.1%)
Mutual labels:  argon
Onednn
oneAPI Deep Neural Network Library (oneDNN)
Stars: ✭ 2,600 (+3461.64%)
Mutual labels:  avx2
Libpopcnt
🚀 Fast C/C++ bit population count library
Stars: ✭ 219 (+200%)
Mutual labels:  avx2
Cryptography-Guidelines
Guidance on implementing cryptography as a developer.
Stars: ✭ 15 (-79.45%)
Mutual labels:  blake2b
Simdjson
Parsing gigabytes of JSON per second
Stars: ✭ 15,115 (+20605.48%)
Mutual labels:  avx2
simd-byte-lookup
SIMDized check which bytes are in a set
Stars: ✭ 23 (-68.49%)
Mutual labels:  avx2
Highwayhash
Node.js implementation of HighwayHash, Google's fast and strong hash function
Stars: ✭ 183 (+150.68%)
Mutual labels:  avx2
Kryptor
A simple, modern, and secure encryption and signing tool that aims to be a better version of age and Minisign.
Stars: ✭ 267 (+265.75%)
Mutual labels:  blake2b
argon-aframe
glue to use aframe to author argon applications
Stars: ✭ 45 (-38.36%)
Mutual labels:  argon
Turbo-Transpose
Transpose: SIMD Integer+Floating Point Compression Filter
Stars: ✭ 50 (-31.51%)
Mutual labels:  avx2
ternary-logic
Support for ternary logic in SSE, XOP, AVX2 and x86 programs
Stars: ✭ 21 (-71.23%)
Mutual labels:  avx2

Argonishche

Build Status

Overview

The library comprises an implementation of Argon2 (i, d, id) and Blake2B algorithms that features the following:

  • C++14 interface
  • constexpr and partial templates to get rid of useless branches
  • SSE2, SSSE3, SSE4.1, AVX2 optimized implementations of Argon2 and Blake2B
  • Runtime CPU dispatching (a partiular implementation is chosen runtime depending on SIMD extentions available in the CPU)
  • OpenMP for multithreading in contrast to pthread in the Argon2 reference implementation
  • In contrast to the Argon2 reference implementation the library uses SIMD-optimized Blake2B

How to use

#include <argonishche.h>

uint32_t tcost = 1;     /* one pass */
uint32_t mcost = 32;    /* in KB */
uint32_t threads = 1;   /* one thread version */
bool runTest = false; /* by default factory runs a quick runtime test; pass 'false' to disable it */

argonishche::Argon2Factory afactory(runTest);
std::unique_ptr<argonishche::Argon2Base> argon2 = afactory.Create(argonishche::Argon2Type::Argon2_d, tcost, mcost, threads, key, keylen);
argon2->Hash(input, insize, salt, saltsize, out, outlen);
bool result = argon2->Verify(pwd, pwdlen, salt, saltlen, hash, hashlen, aad, addlen);

argonishche::Blake2BFactory bfactory(runTest);
uint32_t outlen = 32;
std::unique_ptr<argonishche::Blake2Base> blake2b = bfactory.Create(outlen, key, keylen);
blake2b->Update(in, inlen);
blake2b->Final(out, outlen);

There are also HashWithCustomMemory and VerifyWithCustomMemory methods to which you can pass a memory area to use it for computations and to save a little on memory allocation. GetMemorySize method returns the size of memory area that required for a particular instance.

Benchmark results

On my OS X 10.11, MacBook Pro (Early 2015, Core i5 2,7 GHz, 16 GB 1867 MHz DDR3) for (Argon2_d, 1, 2048, 1) it gives:

Implementation Speed per one core (H/s)
REF (x64 w/o optimizations) 458.51
SSE2 665.17
SSSE3 743.86
SSE4.1 723.41
AVX2 1120.14

On Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz for (Argon2_d, 1, 2048, 1) it gives:

Implementation Speed per one core (H/s)
REF (x64 w/o optimizations) 423.9
SSE2 663.42
SSSE3 715.33
SSE4.1 720.12
AVX2 1130.36

How to add your own Argon2 configuration

The library uses constexpr to calculate some values at compile time. mcost value is a template variable, so the library doesn't support arbitrary mcost values except for predefined ones (in practise you usually don't need it).

To add a new mcost value just modify the file internal/proxy/proxy_macros.h and add appropriate ARGON2_INSTANCE_DECL declaration.

cmake options

You can use the following cmake options:

Option Default value Description
BUILD_WITH_OPENMP ON Use OpenMP if it's available
BUILD_TESTS ON Build library tests
BUILD_BENCHMARK ON Build openssl speed like benchmarking tool

Testing with Intel SDE

One of the tests is intended to run under Intel SDE emulator. Make sure you have SDE in your PATH and run test_sde.sh <build_folder>/test/test_sde.

Other documentation

argonishche.h contains some Doxygen comments so Doxygen can be used to generate documentation.

About the name

Just "Argon" and Russian suffix "-ищ" (-ishch). In Russian suffix "-ищ" (-ishch) means something that is bigger than ordinary and that scares small children. In this case - something that is bigger than Argon :)

Acknowledgements

This project uses some ideas and pieces of code from the following projects licensed under CC0:

And it wouldn't be possible to make the library without work of the following people:

  • Alex Biryukov, Daniel Dinu, Dmitry Khovratovich who designed Argon2 algorithm
  • Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn, Christian Winnerlein who designed Blake2 algorithm

I'm also thankful to Igor Klevanets for his fruitful feedback and code reviews.

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