sorcery-argon2 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql.yml +74 -0
- data/.github/workflows/ruby.yml +13 -3
- data/.rubocop.yml +112 -2
- data/CHANGELOG.md +8 -0
- data/MAINTAINING.md +8 -3
- data/README.md +155 -14
- data/bin/setup +4 -0
- data/ext/argon2_wrap/{Makefile → Makefile.real} +1 -0
- data/ext/argon2_wrap/extconf.rb +4 -1
- data/ext/argon2_wrap/libargon2_wrap.so +0 -0
- data/ext/argon2_wrap/tests +0 -0
- data/ext/phc-winner-argon2/.git +1 -0
- data/ext/phc-winner-argon2/.gitattributes +10 -0
- data/ext/phc-winner-argon2/.gitignore +22 -0
- data/ext/phc-winner-argon2/.travis.yml +25 -0
- data/ext/phc-winner-argon2/Argon2.sln +158 -0
- data/ext/phc-winner-argon2/CHANGELOG.md +32 -0
- data/ext/phc-winner-argon2/LICENSE +314 -0
- data/ext/phc-winner-argon2/Makefile +255 -0
- data/ext/phc-winner-argon2/Package.swift +46 -0
- data/ext/phc-winner-argon2/README.md +303 -0
- data/ext/phc-winner-argon2/appveyor.yml +25 -0
- data/ext/phc-winner-argon2/argon2-specs.pdf +0 -0
- data/ext/phc-winner-argon2/export.sh +7 -0
- data/ext/phc-winner-argon2/include/argon2.h +437 -0
- data/ext/phc-winner-argon2/kats/argon2d +12304 -0
- data/ext/phc-winner-argon2/kats/argon2d.shasum +1 -0
- data/ext/phc-winner-argon2/kats/argon2d_v16 +12304 -0
- data/ext/phc-winner-argon2/kats/argon2d_v16.shasum +1 -0
- data/ext/phc-winner-argon2/kats/argon2i +12304 -0
- data/ext/phc-winner-argon2/kats/argon2i.shasum +1 -0
- data/ext/phc-winner-argon2/kats/argon2i_v16 +12304 -0
- data/ext/phc-winner-argon2/kats/argon2i_v16.shasum +1 -0
- data/ext/phc-winner-argon2/kats/argon2id +12304 -0
- data/ext/phc-winner-argon2/kats/argon2id.shasum +1 -0
- data/ext/phc-winner-argon2/kats/argon2id_v16 +12304 -0
- data/ext/phc-winner-argon2/kats/argon2id_v16.shasum +1 -0
- data/ext/phc-winner-argon2/kats/check-sums.ps1 +42 -0
- data/ext/phc-winner-argon2/kats/check-sums.sh +13 -0
- data/ext/phc-winner-argon2/kats/test.ps1 +50 -0
- data/ext/phc-winner-argon2/kats/test.sh +49 -0
- data/ext/phc-winner-argon2/latex/IEEEtran.cls +6347 -0
- data/ext/phc-winner-argon2/latex/Makefile +18 -0
- data/ext/phc-winner-argon2/latex/argon2-specs.tex +920 -0
- data/ext/phc-winner-argon2/latex/pics/argon2-par.pdf +0 -0
- data/ext/phc-winner-argon2/latex/pics/compression.pdf +0 -0
- data/ext/phc-winner-argon2/latex/pics/generic.pdf +0 -0
- data/ext/phc-winner-argon2/latex/pics/power-distribution.jpg +0 -0
- data/ext/phc-winner-argon2/latex/tradeoff.bib +822 -0
- data/ext/phc-winner-argon2/libargon2.pc.in +18 -0
- data/ext/phc-winner-argon2/man/argon2.1 +57 -0
- data/ext/phc-winner-argon2/src/argon2.c +452 -0
- data/ext/phc-winner-argon2/src/bench.c +111 -0
- data/ext/phc-winner-argon2/src/blake2/blake2-impl.h +156 -0
- data/ext/phc-winner-argon2/src/blake2/blake2.h +89 -0
- data/ext/phc-winner-argon2/src/blake2/blake2b.c +390 -0
- data/ext/phc-winner-argon2/src/blake2/blamka-round-opt.h +471 -0
- data/ext/phc-winner-argon2/src/blake2/blamka-round-ref.h +56 -0
- data/ext/phc-winner-argon2/src/core.c +648 -0
- data/ext/phc-winner-argon2/src/core.h +228 -0
- data/ext/phc-winner-argon2/src/encoding.c +463 -0
- data/ext/phc-winner-argon2/src/encoding.h +57 -0
- data/ext/phc-winner-argon2/src/genkat.c +213 -0
- data/ext/phc-winner-argon2/src/genkat.h +51 -0
- data/ext/phc-winner-argon2/src/opt.c +283 -0
- data/ext/phc-winner-argon2/src/ref.c +194 -0
- data/ext/phc-winner-argon2/src/run.c +337 -0
- data/ext/phc-winner-argon2/src/test.c +289 -0
- data/ext/phc-winner-argon2/src/thread.c +57 -0
- data/ext/phc-winner-argon2/src/thread.h +67 -0
- data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj +231 -0
- data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj.filters +69 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj +231 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj.filters +69 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj +230 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj.filters +66 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj +244 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj.filters +72 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj +235 -0
- data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj.filters +69 -0
- data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj +243 -0
- data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj.filters +69 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj +231 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj.filters +69 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj +230 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj.filters +66 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj +232 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj.filters +72 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj +231 -0
- data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj.filters +69 -0
- data/lib/argon2/ffi_engine.rb +4 -4
- data/lib/argon2/password.rb +28 -5
- data/lib/argon2/version.rb +1 -1
- data/sorcery-argon2.gemspec +3 -2
- metadata +91 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e4215adcc0a57d9fcc8071040414837e73050e632408e6abc5ee21dd3a23730
|
4
|
+
data.tar.gz: 94f1747cfcde31199ccd8eca3a6b4a8224e6f60b7f20e7480ef30f572a1822fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6dfb414d7f24c4b710184c8bdcf35490d9ed29decde5090575421fddb88813dc62beac0755a5b2f5f0528e33e82600f7908812e87f8e2e36f9030e365ec5a21
|
7
|
+
data.tar.gz: 985ba0f248274fd28acb7b0e9d62029b8b93eaaf755561e36d358ff0bdb6fe9dfa4e1cbcbbfc6e165b1ac4a90704377d2e94190f525e7cb4087dca4829fe83cb
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
2
|
+
# to commit it to your repository.
|
3
|
+
#
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
5
|
+
# or to provide custom queries or build logic.
|
6
|
+
#
|
7
|
+
# ******** NOTE ********
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
10
|
+
# supported CodeQL languages.
|
11
|
+
#
|
12
|
+
name: "CodeQL"
|
13
|
+
|
14
|
+
on:
|
15
|
+
push:
|
16
|
+
branches: [ "master" ]
|
17
|
+
pull_request:
|
18
|
+
# The branches below must be a subset of the branches above
|
19
|
+
branches: [ "master" ]
|
20
|
+
schedule:
|
21
|
+
- cron: '34 3 * * 3'
|
22
|
+
|
23
|
+
jobs:
|
24
|
+
analyze:
|
25
|
+
name: Analyze
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
permissions:
|
28
|
+
actions: read
|
29
|
+
contents: read
|
30
|
+
security-events: write
|
31
|
+
|
32
|
+
strategy:
|
33
|
+
fail-fast: false
|
34
|
+
matrix:
|
35
|
+
language: [ 'ruby' ]
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
37
|
+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
38
|
+
|
39
|
+
steps:
|
40
|
+
- name: Checkout repository
|
41
|
+
uses: actions/checkout@v3
|
42
|
+
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
44
|
+
- name: Initialize CodeQL
|
45
|
+
uses: github/codeql-action/init@v2
|
46
|
+
with:
|
47
|
+
languages: ${{ matrix.language }}
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
51
|
+
|
52
|
+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
53
|
+
# queries: security-extended,security-and-quality
|
54
|
+
|
55
|
+
|
56
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
57
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
58
|
+
- name: Autobuild
|
59
|
+
uses: github/codeql-action/autobuild@v2
|
60
|
+
|
61
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
62
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
63
|
+
|
64
|
+
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
65
|
+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
66
|
+
|
67
|
+
# - run: |
|
68
|
+
# echo "Run, Build Application using script"
|
69
|
+
# ./location_of_script_within_repo/buildscript.sh
|
70
|
+
|
71
|
+
- name: Perform CodeQL Analysis
|
72
|
+
uses: github/codeql-action/analyze@v2
|
73
|
+
with:
|
74
|
+
category: "/language:${{matrix.language}}"
|
data/.github/workflows/ruby.yml
CHANGED
@@ -17,6 +17,8 @@ jobs:
|
|
17
17
|
- 2.6
|
18
18
|
- 2.7
|
19
19
|
- 3.0
|
20
|
+
- 3.1
|
21
|
+
- 3.2
|
20
22
|
- head
|
21
23
|
|
22
24
|
runs-on: ${{ matrix.os }}-latest
|
@@ -31,14 +33,18 @@ jobs:
|
|
31
33
|
with:
|
32
34
|
ruby-version: ${{ matrix.ruby }}
|
33
35
|
bundler-cache: true
|
34
|
-
- name: Initialize Git Submodules
|
35
|
-
run: git submodule update --init --recursive
|
36
36
|
- name: Build Argon2 C library
|
37
37
|
run: bin/setup
|
38
38
|
- name: Test Argon2 C library
|
39
39
|
run: bin/test
|
40
40
|
- name: Run tests
|
41
41
|
run: bundle exec rake test
|
42
|
+
- name: Coveralls Parallel
|
43
|
+
uses: coverallsapp/github-action@master
|
44
|
+
with:
|
45
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
46
|
+
flag-name: run-${{ matrix.ruby-version }}
|
47
|
+
parallel: true
|
42
48
|
|
43
49
|
rubocop:
|
44
50
|
|
@@ -54,7 +60,6 @@ jobs:
|
|
54
60
|
- name: Run rubocop
|
55
61
|
run: bundle exec rake rubocop
|
56
62
|
|
57
|
-
# TODO: Add code coverage testing (coveralls)
|
58
63
|
# TODO: Add documentation/maintainability testing?
|
59
64
|
# TODO: Add dependency testing? (bundle audit)
|
60
65
|
|
@@ -62,5 +67,10 @@ jobs:
|
|
62
67
|
runs-on: ubuntu-latest
|
63
68
|
needs: [ test_matrix, rubocop ]
|
64
69
|
steps:
|
70
|
+
- name: Coveralls Finished
|
71
|
+
uses: coverallsapp/github-action@master
|
72
|
+
with:
|
73
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
74
|
+
parallel-finished: true
|
65
75
|
- name: Wait for status checks
|
66
76
|
run: echo "All Green!"
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
Metrics/AbcSize:
|
2
|
-
Max:
|
2
|
+
Max: 21
|
3
|
+
|
4
|
+
Metrics/ClassLength:
|
5
|
+
Exclude:
|
6
|
+
- 'lib/argon2/password.rb'
|
3
7
|
|
4
8
|
Metrics/CyclomaticComplexity:
|
5
9
|
Enabled: false
|
@@ -7,6 +11,11 @@ Metrics/CyclomaticComplexity:
|
|
7
11
|
Metrics/PerceivedComplexity:
|
8
12
|
Enabled: false
|
9
13
|
|
14
|
+
Metrics/ParameterLists:
|
15
|
+
Max: 5
|
16
|
+
Exclude:
|
17
|
+
- 'lib/argon2/ffi_engine.rb'
|
18
|
+
|
10
19
|
Layout/LineLength:
|
11
20
|
Max: 160
|
12
21
|
Exclude:
|
@@ -205,4 +214,105 @@ Style/RedundantArgument: # (new in 1.4)
|
|
205
214
|
Enabled: true
|
206
215
|
Style/SwapValues: # (new in 1.1)
|
207
216
|
Enabled: true
|
208
|
-
|
217
|
+
Lint/DeprecatedConstants: # (new in 1.8)
|
218
|
+
Enabled: true
|
219
|
+
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
|
220
|
+
Enabled: true
|
221
|
+
Lint/NumberedParameterAssignment: # (new in 1.9)
|
222
|
+
Enabled: true
|
223
|
+
Lint/OrAssignmentToConstant: # (new in 1.9)
|
224
|
+
Enabled: true
|
225
|
+
Lint/RedundantDirGlobSort: # (new in 1.8)
|
226
|
+
Enabled: true
|
227
|
+
Lint/SymbolConversion: # (new in 1.9)
|
228
|
+
Enabled: true
|
229
|
+
Lint/TripleQuotes: # (new in 1.9)
|
230
|
+
Enabled: true
|
231
|
+
Style/EndlessMethod: # (new in 1.8)
|
232
|
+
Enabled: true
|
233
|
+
Style/HashConversion: # (new in 1.10)
|
234
|
+
Enabled: true
|
235
|
+
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
|
236
|
+
Enabled: true
|
237
|
+
Style/StringChars: # (new in 1.12)
|
238
|
+
Enabled: true
|
239
|
+
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
|
240
|
+
Enabled: true
|
241
|
+
Gemspec/RequireMFA: # new in 1.23
|
242
|
+
Enabled: true
|
243
|
+
Layout/LineContinuationLeadingSpace: # new in 1.31
|
244
|
+
Enabled: true
|
245
|
+
Layout/LineContinuationSpacing: # new in 1.31
|
246
|
+
Enabled: true
|
247
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
248
|
+
Enabled: true
|
249
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
250
|
+
Enabled: true
|
251
|
+
Lint/AmbiguousRange: # new in 1.19
|
252
|
+
Enabled: true
|
253
|
+
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
254
|
+
Enabled: true
|
255
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
256
|
+
Enabled: true
|
257
|
+
Lint/EmptyInPattern: # new in 1.16
|
258
|
+
Enabled: true
|
259
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
260
|
+
Enabled: true
|
261
|
+
Lint/NonAtomicFileOperation: # new in 1.31
|
262
|
+
Enabled: true
|
263
|
+
Lint/RefinementImportMethods: # new in 1.27
|
264
|
+
Enabled: true
|
265
|
+
Lint/RequireRangeParentheses: # new in 1.32
|
266
|
+
Enabled: true
|
267
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
268
|
+
Enabled: true
|
269
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
270
|
+
Enabled: true
|
271
|
+
Naming/BlockForwarding: # new in 1.24
|
272
|
+
Enabled: true
|
273
|
+
Security/CompoundHash: # new in 1.28
|
274
|
+
Enabled: true
|
275
|
+
Security/IoMethods: # new in 1.22
|
276
|
+
Enabled: true
|
277
|
+
Style/EmptyHeredoc: # new in 1.32
|
278
|
+
Enabled: true
|
279
|
+
Style/EnvHome: # new in 1.29
|
280
|
+
Enabled: true
|
281
|
+
Style/FetchEnvVar: # new in 1.28
|
282
|
+
Enabled: true
|
283
|
+
Style/FileRead: # new in 1.24
|
284
|
+
Enabled: true
|
285
|
+
Style/FileWrite: # new in 1.24
|
286
|
+
Enabled: true
|
287
|
+
Style/InPatternThen: # new in 1.16
|
288
|
+
Enabled: true
|
289
|
+
Style/MagicCommentFormat: # new in 1.35
|
290
|
+
Enabled: true
|
291
|
+
Style/MapCompactWithConditionalBlock: # new in 1.30
|
292
|
+
Enabled: true
|
293
|
+
Style/MapToHash: # new in 1.24
|
294
|
+
Enabled: true
|
295
|
+
Style/MultilineInPatternThen: # new in 1.16
|
296
|
+
Enabled: true
|
297
|
+
Style/NestedFileDirname: # new in 1.26
|
298
|
+
Enabled: true
|
299
|
+
Style/NumberedParameters: # new in 1.22
|
300
|
+
Enabled: true
|
301
|
+
Style/NumberedParametersLimit: # new in 1.22
|
302
|
+
Enabled: true
|
303
|
+
Style/ObjectThen: # new in 1.28
|
304
|
+
Enabled: true
|
305
|
+
Style/OpenStructUse: # new in 1.23
|
306
|
+
Enabled: true
|
307
|
+
Style/OperatorMethodCall: # new in 1.37
|
308
|
+
Enabled: true
|
309
|
+
Style/QuotedSymbols: # new in 1.16
|
310
|
+
Enabled: true
|
311
|
+
Style/RedundantInitialize: # new in 1.27
|
312
|
+
Enabled: true
|
313
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
314
|
+
Enabled: true
|
315
|
+
Style/RedundantStringEscape: # new in 1.37
|
316
|
+
Enabled: true
|
317
|
+
Style/SelectByRegexp: # new in 1.22
|
318
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ Historical changelog for all versions.
|
|
4
4
|
|
5
5
|
## HEAD
|
6
6
|
|
7
|
+
## v1.2.0
|
8
|
+
|
9
|
+
* Synced with latest upstream changes (technion/ruby-argon2 `v2.2.0`)
|
10
|
+
|
11
|
+
## v1.1.0
|
12
|
+
|
13
|
+
* Added support for passing parallelism cost to `Argon2::Password.create`
|
14
|
+
|
7
15
|
## v1.0.0
|
8
16
|
|
9
17
|
This project has been forked from
|
data/MAINTAINING.md
CHANGED
@@ -57,9 +57,14 @@ NOTE: `X.Y.Z` and `vX.Y.Z` are given as examples, and should be replaced with
|
|
57
57
|
1. Stage your changes and create a commit
|
58
58
|
1. `git add -A`
|
59
59
|
1. `git commit -m "Release vX.Y.Z"`
|
60
|
-
|
61
|
-
1.
|
60
|
+
1. Ensure all tests are passing
|
61
|
+
1. `./bin/setup`
|
62
|
+
1. `./bin/test` (you may need to install clang, e.g. `sudo apt install clang`)
|
63
|
+
1. `rake default`
|
64
|
+
1. Build the Gem
|
62
65
|
1. `gem build`
|
66
|
+
1. Test installation: `gem install sorcery-argon2-X.Y.Z.gem`
|
67
|
+
1. Push the new release
|
68
|
+
1. `git push`
|
63
69
|
1. `gem push <filename>`
|
64
|
-
1. TODO: Version tagging
|
65
70
|
1. Release new version via github interface
|
data/README.md
CHANGED
@@ -1,20 +1,28 @@
|
|
1
1
|
# Argon2 - Ruby Wrapper
|
2
2
|
|
3
|
-
|
4
|
-
the `argon2` gem, `v2.0.3`. See below for a migration guide if you would like to
|
5
|
-
move an existing application from `argon2` to `sorcery-argon2`.
|
3
|
+
A ruby wrapper for the Argon2 password hashing algorithm.
|
6
4
|
|
7
|
-
|
5
|
+
*This is an independent project, and not official from the PHC team.*
|
6
|
+
|
7
|
+
This gem provides a 1:1 replacement for the `argon2` gem, with various
|
8
|
+
improvements. Want to know more about why `argon2` was forked?
|
9
|
+
[Read more](#why-fork-argon2)
|
10
|
+
|
11
|
+
Wish to upgrade an existing application to use the improved API?
|
12
|
+
[Migration guide](#migrating-from-argon2-to-sorcery-argon2)
|
13
|
+
|
14
|
+
This fork is kept up-to-date with `argon2`, latest sync: `argon2 - v2.2.0`
|
8
15
|
|
9
16
|
## Table of Contents
|
10
17
|
|
11
18
|
1. [Useful Links](#useful-links)
|
12
19
|
2. [API Summary](#api-summary)
|
13
20
|
3. [Installation](#installation)
|
14
|
-
4. [
|
15
|
-
5. [
|
16
|
-
6. [
|
17
|
-
7. [
|
21
|
+
4. [Why fork `argon2`?](#why-fork-argon2)
|
22
|
+
5. [Migrating from `argon2` to `sorcery-argon2`](#migrating-from-argon2-to-sorcery-argon2)
|
23
|
+
6. [Contributing](#contributing)
|
24
|
+
7. [Contact](#contact)
|
25
|
+
8. [License](#license)
|
18
26
|
|
19
27
|
## Useful Links
|
20
28
|
|
@@ -93,13 +101,146 @@ Require Sorcery-Argon2 in your project:
|
|
93
101
|
require 'argon2'
|
94
102
|
```
|
95
103
|
|
104
|
+
## Why fork `argon2`?
|
105
|
+
|
106
|
+
While implementing Argon2 support in Sorcery v1, I noticed that the current
|
107
|
+
ruby wrapper (`argon2` - [technion/ruby-argon2](https://github.com/technion/ruby-argon2))
|
108
|
+
had some questionable design decisions, and attempted to address them through a
|
109
|
+
pull request. The sole maintainer of the gem rejected these changes summarily,
|
110
|
+
without pointing out any specific concerns other than not understanding why the
|
111
|
+
changes were necessary. This lead to me ([@joshbuker](https://github.com/joshbuker))
|
112
|
+
being directed to create a fork instead:
|
113
|
+
[technion/ruby-argon2#44](https://github.com/technion/ruby-argon2/pull/44#issuecomment-816271661)
|
114
|
+
|
115
|
+
### Why should I trust this fork?
|
116
|
+
|
117
|
+
You shouldn't trust this code more than you trust any other open source project.
|
118
|
+
It's written by someone you don't know, and even if there is no malicious
|
119
|
+
intent, there is no guarantee that the code is secure. Open source security is
|
120
|
+
driven by having the community vett popular libraries, and discovering flaws
|
121
|
+
through the sheer number of intelligent community members looking at the code.
|
122
|
+
|
123
|
+
That being said, the original library `argon2` also falls under the same
|
124
|
+
category. Ultimately, it was also written by a single person and is not
|
125
|
+
thoroughly vetted by the community at the time of writing. A community member
|
126
|
+
([@joshbuker](https://github.com/joshbuker), in this case) finding flaws in the
|
127
|
+
implementation, and the fixes being rejected from upstream, is how this fork
|
128
|
+
came into being.
|
129
|
+
|
130
|
+
### What are the changes, why are they necessary?
|
131
|
+
|
132
|
+
The Argon2::Password interface was, to put it bluntly, poorly executed in the
|
133
|
+
original library. The Password class instance was not a representation of an
|
134
|
+
Argon2 password as one would expect, but instead an unnecessary abstraction
|
135
|
+
layer used to store the settings passed to the underlying Argon2 C Library. This
|
136
|
+
not only led to an overly complicated method of generating Argon2 hashes, but
|
137
|
+
also meant that the class could not be used to read data back out of an Argon2
|
138
|
+
digest.
|
139
|
+
|
140
|
+
Originally, to generate an Argon2 hash/digest, one would have to do the
|
141
|
+
following:
|
142
|
+
|
143
|
+
```ruby
|
144
|
+
# Create an instance of the Argon2::Password class to store your options:
|
145
|
+
instance = Argon2::Password.new(t_cost: 4, m_cost: 16)
|
146
|
+
# Use this instance to generate the hash by calling create:
|
147
|
+
instance.create(password)
|
148
|
+
=> "$argon2i$v=19$m=65536,t=2,p=1$jL7lLEAjDN+pY2cG1N8D2g$iwj1ueduCvm6B9YVjBSnAHu+6mKzqGmDW745ALR38Uo"
|
149
|
+
```
|
150
|
+
|
151
|
+
Not only is this abstraction step unnecessary, it opens up a new way for
|
152
|
+
developers to make a security mistake. New salts are only generated on the
|
153
|
+
creation of a new Argon2::Password instance, meaning if you reuse the instance,
|
154
|
+
those passwords will share the same salt.
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
instance = Argon2::Password.new(t_cost: 4, m_cost: 16)
|
158
|
+
# digest1 and digest2 will share the same salt:
|
159
|
+
digest1 = instance.create(password1)
|
160
|
+
digest2 = instance.create(password2)
|
161
|
+
```
|
162
|
+
|
163
|
+
Also, because of how the instance of Argon2::Password was designed, it cannot be
|
164
|
+
used for reading information back out of an Argon2::Password. This is a summary
|
165
|
+
of the original Argon2::Password API:
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
# Class methods
|
169
|
+
Argon2::Password.create(password) # Uses the default options to create a digest
|
170
|
+
Argon2::Password.valid_hash?(digest)
|
171
|
+
Argon2::Password.verify_password(password, digest, pepper = nil)
|
172
|
+
|
173
|
+
# Instance Methods
|
174
|
+
argon2 = Argon2::Password.new(options = {}) # Purely for storing options
|
175
|
+
argon2.create(password) # Take the options and generate an Argon2 digest
|
176
|
+
```
|
177
|
+
|
178
|
+
Compare this with `sorcery-argon2`:
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
# Class methods
|
182
|
+
Argon2::Password.create(password, options = {}) # Same as before but accepts passing options
|
183
|
+
Argon2::Password.valid_hash?(digest)
|
184
|
+
Argon2::Password.verify_password(password, digest, pepper = nil)
|
185
|
+
|
186
|
+
# Instance Methods
|
187
|
+
argon2 = Argon2::Password.new(digest) # Now represents an Argon2 digest
|
188
|
+
argon2 == other_argon2 # Which can be compared with `==` against other Argon2::Password instances
|
189
|
+
argon2.matches?(password, pepper = nil) # Or against the original password
|
190
|
+
argon2.to_s # Returns the digest as a String
|
191
|
+
argon2.to_str # Also returns the digest as a String
|
192
|
+
|
193
|
+
# Argon2::Password Attributes (readonly)
|
194
|
+
argon2.digest
|
195
|
+
argon2.variant
|
196
|
+
argon2.version
|
197
|
+
argon2.t_cost
|
198
|
+
argon2.m_cost
|
199
|
+
argon2.p_cost
|
200
|
+
argon2.salt
|
201
|
+
argon2.checksum
|
202
|
+
```
|
203
|
+
|
204
|
+
Another minor issue is that all library errors fall to a single non-descriptive
|
205
|
+
class:
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
Argon2::ArgonHashFail
|
209
|
+
```
|
210
|
+
|
211
|
+
Compare with `sorcery-argon2`:
|
212
|
+
|
213
|
+
```ruby
|
214
|
+
Argon2::Error # Replaces `Argon2::ArgonHashFail`
|
215
|
+
|
216
|
+
# The following errors all inherit from Argon2::Error, and allow you to catch
|
217
|
+
# specifically the error you're interested in:
|
218
|
+
Argon2::Errors::InvalidHash
|
219
|
+
Argon2::Errors::InvalidVersion
|
220
|
+
Argon2::Errors::InvalidCost
|
221
|
+
Argon2::Errors::InvalidTCost
|
222
|
+
Argon2::Errors::InvalidMCost
|
223
|
+
Argon2::Errors::InvalidPCost
|
224
|
+
Argon2::Errors::InvalidPassword
|
225
|
+
Argon2::Errors::InvalidSaltSize
|
226
|
+
Argon2::Errors::InvalidOutputLength
|
227
|
+
Argon2::Errors::ExtError
|
228
|
+
```
|
229
|
+
|
230
|
+
Finally, the original library documentation is not only incomplete, but
|
231
|
+
straight up broken/inaccurate in some areas. `sorcery-argon2` has fixed these
|
232
|
+
issues, and has 100% documentation of the API.
|
233
|
+
|
234
|
+
* [`argon2` Documentation](https://rubydoc.info/gems/argon2)
|
235
|
+
* [`sorcery-argon2` Documentation](https://rubydoc.info/gems/sorcery-argon2)
|
236
|
+
|
96
237
|
## Migrating from `argon2` to `sorcery-argon2`
|
97
238
|
|
98
239
|
There are two primary changes going from `argon2` to `sorcery-argon2`:
|
99
240
|
|
100
241
|
### The Argon2::Password API has been refactored
|
101
242
|
|
102
|
-
|
243
|
+
*Argon2::Password.new and Argon2::Password.create are now different.*
|
103
244
|
|
104
245
|
Argon2::Passwords can now be created without initializing an instance first.
|
105
246
|
|
@@ -115,11 +256,11 @@ instance.create(input_password)
|
|
115
256
|
Argon2::Password.create(input_password, m_cost: some_m_cost)
|
116
257
|
```
|
117
258
|
|
118
|
-
|
259
|
+
*Argon2::Password.create no longer accepts custom salts.*
|
119
260
|
|
120
|
-
You should not be providing your own salt to the Argon2 algorithm (
|
121
|
-
for you). Previously you could pass an option of `salt_do_not_supply`,
|
122
|
-
been removed in `sorcery-argon2 - v1.0.0`.
|
261
|
+
You should not be providing your own salt to the Argon2 algorithm (this library
|
262
|
+
does it for you). Previously you could pass an option of `salt_do_not_supply`,
|
263
|
+
which has been removed in `sorcery-argon2 - v1.0.0`.
|
123
264
|
|
124
265
|
### The errors have been restructured
|
125
266
|
|
@@ -156,7 +297,7 @@ Feel free to ask questions using these contact details:
|
|
156
297
|
|
157
298
|
**Current Maintainers:**
|
158
299
|
|
159
|
-
* Josh Buker ([@
|
300
|
+
* Josh Buker ([@joshbuker](https://github.com/joshbuker)) | [Email](mailto:crypto+sorcery@joshbuker.com?subject=Sorcery)
|
160
301
|
|
161
302
|
## License
|
162
303
|
|
data/bin/setup
CHANGED
@@ -4,8 +4,12 @@ set -euo pipefail
|
|
4
4
|
# Internal Field Separator
|
5
5
|
IFS=$'\n\t'
|
6
6
|
|
7
|
+
# Initialize Git Submodules
|
8
|
+
git submodule update --init --recursive
|
9
|
+
|
7
10
|
# Build the Argon2 C Library. Git submodules must be initialized first!
|
8
11
|
bundle install
|
9
12
|
cd ext/argon2_wrap/
|
13
|
+
ruby extconf.rb
|
10
14
|
make
|
11
15
|
cd ../..
|
data/ext/argon2_wrap/extconf.rb
CHANGED
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
gitdir: ../../.git/modules/ext/phc-winner-argon2
|
@@ -0,0 +1,22 @@
|
|
1
|
+
argon2
|
2
|
+
libargon2.a
|
3
|
+
libargon2.so*
|
4
|
+
libargon2.dylib
|
5
|
+
libargon2.pc
|
6
|
+
.DS_Store
|
7
|
+
src/*.o
|
8
|
+
src/blake2/*.o
|
9
|
+
genkat
|
10
|
+
.idea
|
11
|
+
*.pyc
|
12
|
+
testcase
|
13
|
+
*.gcda
|
14
|
+
*.gcno
|
15
|
+
*.gcov
|
16
|
+
bench
|
17
|
+
vs2015/build
|
18
|
+
Argon2.sdf
|
19
|
+
Argon2.VC.opendb
|
20
|
+
*.zip
|
21
|
+
*.tar.gz
|
22
|
+
tags
|
@@ -0,0 +1,25 @@
|
|
1
|
+
language: c
|
2
|
+
|
3
|
+
compiler:
|
4
|
+
- clang
|
5
|
+
- gcc
|
6
|
+
|
7
|
+
os:
|
8
|
+
- linux
|
9
|
+
- osx
|
10
|
+
|
11
|
+
# Clang on Linux needs to run in a VM to use ASAN.
|
12
|
+
# See: https://github.com/travis-ci/travis-ci/issues/9033
|
13
|
+
matrix:
|
14
|
+
exclude:
|
15
|
+
- compiler: clang
|
16
|
+
os: linux
|
17
|
+
include:
|
18
|
+
- compiler: clang
|
19
|
+
os: linux
|
20
|
+
sudo: true
|
21
|
+
|
22
|
+
script: make && make testci
|
23
|
+
|
24
|
+
after_success:
|
25
|
+
- bash <(curl -s https://codecov.io/bash)
|