{"id":18682879,"url":"https://github.com/yandex/argon2","last_synced_at":"2025-04-12T04:30:54.685Z","repository":{"id":50215725,"uuid":"96438649","full_name":"yandex/argon2","owner":"yandex","description":"Implementation of argon2 (i, d, id) algorithms with CPU dispatching","archived":false,"fork":false,"pushed_at":"2021-06-01T21:06:21.000Z","size":43,"stargazers_count":83,"open_issues_count":1,"forks_count":15,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-26T00:02:15.398Z","etag":null,"topics":["argon","avx2","blake2b","cryptography"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yandex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-06T14:23:03.000Z","updated_at":"2025-02-12T04:52:17.000Z","dependencies_parsed_at":"2022-09-04T19:12:06.572Z","dependency_job_id":null,"html_url":"https://github.com/yandex/argon2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex%2Fargon2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex%2Fargon2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex%2Fargon2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yandex%2Fargon2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yandex","download_url":"https://codeload.github.com/yandex/argon2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248517044,"owners_count":21117369,"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","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":["argon","avx2","blake2b","cryptography"],"created_at":"2024-11-07T10:13:04.801Z","updated_at":"2025-04-12T04:30:54.650Z","avatar_url":"https://github.com/yandex.png","language":"C++","readme":"Argonishche\n===========\n\n[![Build Status](https://travis-ci.org/yandex/argon2.svg?branch=master)](https://travis-ci.org/yandex/argon2)\n\n# Overview\n\nThe library comprises an implementation of Argon2 (i, d, id) and Blake2B algorithms that features the following:\n* C++14 interface\n* constexpr and partial templates to get rid of useless branches\n* SSE2, SSSE3, SSE4.1, AVX2 optimized implementations of Argon2 and Blake2B\n* Runtime CPU dispatching (a partiular implementation is chosen runtime depending on SIMD extentions available in the CPU)\n* OpenMP for multithreading in contrast to pthread in the [Argon2 reference implementation](github.com/P-H-C/phc-winner-argon2) \n* In contrast to the [Argon2 reference implementation](github.com/P-H-C/phc-winner-argon2) the library uses SIMD-optimized Blake2B\n\n# How to use\n\n```\n#include \u003cargonishche.h\u003e\n\nuint32_t tcost = 1;     /* one pass */\nuint32_t mcost = 32;    /* in KB */\nuint32_t threads = 1;   /* one thread version */\nbool runTest = false; /* by default factory runs a quick runtime test; pass 'false' to disable it */\n\nargonishche::Argon2Factory afactory(runTest);\nstd::unique_ptr\u003cargonishche::Argon2Base\u003e argon2 = afactory.Create(argonishche::Argon2Type::Argon2_d, tcost, mcost, threads, key, keylen);\nargon2-\u003eHash(input, insize, salt, saltsize, out, outlen);\nbool result = argon2-\u003eVerify(pwd, pwdlen, salt, saltlen, hash, hashlen, aad, addlen);\n\nargonishche::Blake2BFactory bfactory(runTest);\nuint32_t outlen = 32;\nstd::unique_ptr\u003cargonishche::Blake2Base\u003e blake2b = bfactory.Create(outlen, key, keylen);\nblake2b-\u003eUpdate(in, inlen);\nblake2b-\u003eFinal(out, outlen);\n```\n\nThere 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.\n\n# Benchmark results\n\nOn 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:\n\n| Implementation               | Speed per one core (H/s) |\n|------------------------------|--------------------------|\n| REF (x64 w/o optimizations)  | 458.51                   |\n| SSE2                         | 665.17                   |\n| SSSE3                        | 743.86                   |\n| SSE4.1                       | 723.41                   |\n| AVX2                         | 1120.14                  |\n\nOn Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz for `(Argon2_d, 1, 2048, 1)` it gives:\n\n| Implementation               | Speed per one core (H/s) |\n|------------------------------|--------------------------|\n| REF (x64 w/o optimizations)  | 423.9                    |\n| SSE2                         | 663.42                   |\n| SSSE3                        | 715.33                   |\n| SSE4.1                       | 720.12                   |\n| AVX2                         | 1130.36                  |                    \n\n# How to add your own Argon2 configuration\n\nThe 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).\n\nTo add a new mcost value just modify the file `internal/proxy/proxy_macros.h` and add appropriate `ARGON2_INSTANCE_DECL` declaration.\n\n# cmake options\n\nYou can use the following cmake options:\n\n| Option              |Default value | Description                                  |\n|---------------------|--------------|----------------------------------------------|\n| BUILD_WITH_OPENMP   | ON           | Use OpenMP if it's available                 |\n| BUILD_TESTS         | ON           | Build library tests                          |\n| BUILD_BENCHMARK     | ON           | Build openssl speed like benchmarking tool   |\n\n# Testing with Intel SDE\n\nOne of the tests is intended to run under Intel SDE emulator. Make sure you have SDE in your PATH  and run `test_sde.sh \u003cbuild_folder\u003e/test/test_sde`.\n\n# Other documentation\n\n`argonishche.h` contains some Doxygen comments so Doxygen can be used to generate documentation.\n\n# About the name\n\nJust \"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 :)\n\n# Acknowledgements\n\nThis project uses some ideas and pieces of code from the following projects licensed under CC0:\n* https://github.com/P-H-C/phc-winner-argon2\n* https://github.com/BLAKE2/BLAKE2\n\nAnd it wouldn't be possible to make the library without work of the following people:\n* Alex Biryukov, Daniel Dinu, Dmitry Khovratovich who designed Argon2 algorithm\n* Jean-Philippe Aumasson, Samuel Neves, Zooko Wilcox-O'Hearn, Christian Winnerlein who designed Blake2 algorithm\n\nI'm also thankful to Igor Klevanets for his fruitful feedback and code reviews.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyandex%2Fargon2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyandex%2Fargon2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyandex%2Fargon2/lists"}