argon2 2.2.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +2 -2
  3. data/README.md +35 -8
  4. data/Steepfile +1 -1
  5. data/argon2.gemspec +1 -1
  6. data/lib/argon2/profiles.rb +50 -0
  7. data/lib/argon2/version.rb +1 -1
  8. data/lib/argon2.rb +27 -7
  9. data/sig/argon2.rbs +29 -9
  10. data/sig/engine.rbs +9 -0
  11. data/sig/errors.rbs +6 -0
  12. data/sig/ffi.rbs +3 -3
  13. data/sig/hash_format.rbs +31 -0
  14. metadata +9 -88
  15. data/ext/argon2_wrap/argon_wrap.o +0 -0
  16. data/ext/phc-winner-argon2/.git +0 -1
  17. data/ext/phc-winner-argon2/.gitattributes +0 -10
  18. data/ext/phc-winner-argon2/.gitignore +0 -22
  19. data/ext/phc-winner-argon2/.travis.yml +0 -25
  20. data/ext/phc-winner-argon2/Argon2.sln +0 -158
  21. data/ext/phc-winner-argon2/CHANGELOG.md +0 -32
  22. data/ext/phc-winner-argon2/LICENSE +0 -314
  23. data/ext/phc-winner-argon2/Makefile +0 -255
  24. data/ext/phc-winner-argon2/Package.swift +0 -46
  25. data/ext/phc-winner-argon2/README.md +0 -303
  26. data/ext/phc-winner-argon2/appveyor.yml +0 -25
  27. data/ext/phc-winner-argon2/argon2-specs.pdf +0 -0
  28. data/ext/phc-winner-argon2/export.sh +0 -7
  29. data/ext/phc-winner-argon2/include/argon2.h +0 -437
  30. data/ext/phc-winner-argon2/kats/argon2d +0 -12304
  31. data/ext/phc-winner-argon2/kats/argon2d.shasum +0 -1
  32. data/ext/phc-winner-argon2/kats/argon2d_v16 +0 -12304
  33. data/ext/phc-winner-argon2/kats/argon2d_v16.shasum +0 -1
  34. data/ext/phc-winner-argon2/kats/argon2i +0 -12304
  35. data/ext/phc-winner-argon2/kats/argon2i.shasum +0 -1
  36. data/ext/phc-winner-argon2/kats/argon2i_v16 +0 -12304
  37. data/ext/phc-winner-argon2/kats/argon2i_v16.shasum +0 -1
  38. data/ext/phc-winner-argon2/kats/argon2id +0 -12304
  39. data/ext/phc-winner-argon2/kats/argon2id.shasum +0 -1
  40. data/ext/phc-winner-argon2/kats/argon2id_v16 +0 -12304
  41. data/ext/phc-winner-argon2/kats/argon2id_v16.shasum +0 -1
  42. data/ext/phc-winner-argon2/kats/check-sums.ps1 +0 -42
  43. data/ext/phc-winner-argon2/kats/check-sums.sh +0 -13
  44. data/ext/phc-winner-argon2/kats/test.ps1 +0 -50
  45. data/ext/phc-winner-argon2/kats/test.sh +0 -49
  46. data/ext/phc-winner-argon2/latex/IEEEtran.cls +0 -6347
  47. data/ext/phc-winner-argon2/latex/Makefile +0 -18
  48. data/ext/phc-winner-argon2/latex/argon2-specs.tex +0 -920
  49. data/ext/phc-winner-argon2/latex/pics/argon2-par.pdf +0 -0
  50. data/ext/phc-winner-argon2/latex/pics/compression.pdf +0 -0
  51. data/ext/phc-winner-argon2/latex/pics/generic.pdf +0 -0
  52. data/ext/phc-winner-argon2/latex/pics/power-distribution.jpg +0 -0
  53. data/ext/phc-winner-argon2/latex/tradeoff.bib +0 -822
  54. data/ext/phc-winner-argon2/libargon2.pc.in +0 -18
  55. data/ext/phc-winner-argon2/man/argon2.1 +0 -57
  56. data/ext/phc-winner-argon2/src/argon2.c +0 -452
  57. data/ext/phc-winner-argon2/src/bench.c +0 -111
  58. data/ext/phc-winner-argon2/src/blake2/blake2-impl.h +0 -156
  59. data/ext/phc-winner-argon2/src/blake2/blake2.h +0 -89
  60. data/ext/phc-winner-argon2/src/blake2/blake2b.c +0 -390
  61. data/ext/phc-winner-argon2/src/blake2/blamka-round-opt.h +0 -471
  62. data/ext/phc-winner-argon2/src/blake2/blamka-round-ref.h +0 -56
  63. data/ext/phc-winner-argon2/src/core.c +0 -648
  64. data/ext/phc-winner-argon2/src/core.h +0 -228
  65. data/ext/phc-winner-argon2/src/encoding.c +0 -463
  66. data/ext/phc-winner-argon2/src/encoding.h +0 -57
  67. data/ext/phc-winner-argon2/src/genkat.c +0 -213
  68. data/ext/phc-winner-argon2/src/genkat.h +0 -51
  69. data/ext/phc-winner-argon2/src/opt.c +0 -283
  70. data/ext/phc-winner-argon2/src/ref.c +0 -194
  71. data/ext/phc-winner-argon2/src/run.c +0 -337
  72. data/ext/phc-winner-argon2/src/test.c +0 -289
  73. data/ext/phc-winner-argon2/src/thread.c +0 -57
  74. data/ext/phc-winner-argon2/src/thread.h +0 -67
  75. data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj +0 -231
  76. data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj.filters +0 -69
  77. data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj +0 -231
  78. data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj.filters +0 -69
  79. data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj +0 -230
  80. data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj.filters +0 -66
  81. data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj +0 -244
  82. data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj.filters +0 -72
  83. data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj +0 -235
  84. data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj.filters +0 -69
  85. data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj +0 -243
  86. data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj.filters +0 -69
  87. data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj +0 -231
  88. data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj.filters +0 -69
  89. data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj +0 -230
  90. data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj.filters +0 -66
  91. data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj +0 -232
  92. data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj.filters +0 -72
  93. data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj +0 -231
  94. data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj.filters +0 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f926025634562667dbc1575383b09a6d3178248f1551325726f1dc194472b0e5
4
- data.tar.gz: a4876cbbaf99df1062ac39f668e3af254c5b45b1d431bf5e7180e3076fd20d3d
3
+ metadata.gz: 8cbb2f441975a9655ec4d22d828eb1c974dbe517743bf09986879ce8e1d6d9fa
4
+ data.tar.gz: 6eaf7422106042a80eb3278b140ad48a6e08c02ca25cab661cc50eaada001556
5
5
  SHA512:
6
- metadata.gz: e5c592dc870390af4ad6fbce1ea4b3b4b5be6fa25574f18ac44d0509dab1adef3bb21e1e1c5a84b01d364e335f4b4b01460a0a4207c96734ae67f0b4ff12289a
7
- data.tar.gz: c59f5baeea0c7ff436f77a4dadc267c5619ceccf2749ee25a428173abbf4842606a48bbd90f74a89cbd6347cc31dc643447b926cb6caccdcbcf04d7eabfb19a8
6
+ metadata.gz: '07964785e432965f553ee8178693c4a13125ec31339e8c2cdc1ad5504eba39b50a25db25708cb3930a4f297ff6108f2bc7eca900edebe35173d73100e09cbe24'
7
+ data.tar.gz: fe6b19cf9f1fa720a707286eec6897146bc544ff8cc5cca8da48e7d06c077c157b639cfcc285d3619ff6e97fd8e8fff6813793c1f7ad07c3f0ae88e44d44e17b
@@ -14,8 +14,8 @@ jobs:
14
14
  - macos
15
15
  ruby:
16
16
  - 2.7
17
- - 3.1
18
- - 3.2
17
+ - 3.3
18
+ - 3.4
19
19
 
20
20
  runs-on: ${{ matrix.os }}-latest
21
21
 
data/README.md CHANGED
@@ -27,26 +27,50 @@ Require this in your Gemfile like a typical Ruby gem:
27
27
  require 'argon2'
28
28
  ```
29
29
 
30
- To generate a hash using specific time and memory cost:
30
+ To utilise default costs ([RFC 9106](https://www.rfc-editor.org/rfc/rfc9106#name-parameter-choice)'s lower-memory, second recommended parameters):
31
31
 
32
32
  ```ruby
33
- hasher = Argon2::Password.new(t_cost: 2, m_cost: 16, p_cost: 1)
33
+ hasher = Argon2::Password.new
34
34
  hasher.create("password")
35
- => "$argon2i$v=19$m=65536,t=2,p=1$jL7lLEAjDN+pY2cG1N8D2g$iwj1ueduCvm6B9YVjBSnAHu+6mKzqGmDW745ALR38Uo"
36
35
  ```
37
36
 
38
- To utilise default costs:
37
+ Alternatively, use this shortcut:
39
38
 
40
39
  ```ruby
41
- hasher = Argon2::Password.new
40
+ Argon2::Password.create("password")
41
+ => "$argon2i$v=19$m=65536,t=2,p=1$61qkSyYNbUgf3kZH3GtHRw$4CQff9AZ0lWd7uF24RKMzqEiGpzhte1Hp8SO7X8bAew"
42
+ ```
43
+
44
+ If your use case can afford the higher memory consumption/cost, you can/should specify to use RFC 9106's first recommended parameters:
45
+
46
+ ```ruby
47
+ hasher = Argon2::Password.new(profile: :rfc_9106_high_memory)
42
48
  hasher.create("password")
49
+ => "$argon2id$v=19$m=2097152,t=1,p=4$LvHa74Yax7uCWPN7P6/oQQ$V1dMt4dfuYSmLpwUTpKUzg+RrXjWzWHlE6NLowBzsAg"
43
50
  ```
44
51
 
45
- Alternatively, use this shortcut:
52
+ To generate a hash using one of the other `Argon::Profiles` names:
46
53
 
47
54
  ```ruby
48
- Argon2::Password.create("password")
49
- => "$argon2i$v=19$m=65536,t=2,p=1$61qkSyYNbUgf3kZH3GtHRw$4CQff9AZ0lWd7uF24RKMzqEiGpzhte1Hp8SO7X8bAew"
55
+ # Only use this profile in testing env, it's unsafe!
56
+ hasher = Argon2::Password.new(profile: :unsafe_cheapest)
57
+ hasher.create("password")
58
+ => "$argon2id$v=19$m=8,t=1,p=1$HZZHG3oTqptqgrxWxFic5g$EUokHMU6m6w2AVIEk1MpZBhVwW9Nj+ESRjPwTBVtWpY"
59
+ ```
60
+
61
+ The list of named cost profiles are:
62
+
63
+ * `:rfc_9106_high_memory`: the first recommended option but is expensive
64
+ * `:rfc_9106_low_memory`: the second recommended option (default)
65
+ * `:pre_rfc_9106`: the previous default costs for `ruby-argon2` <= v2.2.0, before offering RFC 9106 named profiles
66
+ * `:unsafe_cheapest`: Strictly for testing, the minimum costs allowed by Argon2 for the fastest hashing speed
67
+
68
+ To generate a hash using specific time and memory cost:
69
+
70
+ ```ruby
71
+ hasher = Argon2::Password.new(t_cost: 2, m_cost: 16, p_cost: 1)
72
+ hasher.create("password")
73
+ => "$argon2i$v=19$m=65536,t=2,p=1$jL7lLEAjDN+pY2cG1N8D2g$iwj1ueduCvm6B9YVjBSnAHu+6mKzqGmDW745ALR38Uo"
50
74
  ```
51
75
 
52
76
  You can then use this function to verify a password against a given hash. Will return either true or false.
@@ -81,6 +105,9 @@ steep check
81
105
  ```
82
106
  These tools will need to be installed manually at this time and will be added to Gemfiles after much further testing.
83
107
 
108
+ ## Version 2.2.0
109
+ This version changed the way the build system works to deal with a new version of Rubygems. See https://github.com/technion/ruby-argon2/issues/56.
110
+
84
111
  ## Version 2.0 - Argon 2id
85
112
  Version 2.x upwards will now default to the Argon2id hash format. This is consistent with current recommendations regarding Argon2 usage. It remains capable of verifying existing hashes.
86
113
 
data/Steepfile CHANGED
@@ -4,7 +4,7 @@ target :lib do
4
4
  signature "sig"
5
5
 
6
6
  check "argon2.rb"
7
- check "lib" # Directory name
7
+ check "lib" # Directory name
8
8
  ignore "lib/argon2/ffi_engine.rb"
9
9
  ignore "lib/argon2/errors.rb"
10
10
  end
data/argon2.gemspec CHANGED
@@ -36,6 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "rubocop", '~> 1.7'
37
37
  spec.add_development_dependency "simplecov", '~> 0.20'
38
38
  spec.add_development_dependency "simplecov-lcov", '~> 0.8'
39
- spec.add_development_dependency "steep", "~> 1.2.1"
39
+ spec.add_development_dependency "steep", "~> 1.9.3"
40
40
  spec.extensions << 'ext/argon2_wrap/extconf.rb'
41
41
  end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Argon2
4
+ # Contains named profiles of different common cost parameter sets
5
+ class Profiles
6
+ def self.[](name)
7
+ name = name.upcase.to_sym
8
+ raise NotImplementedError unless const_defined?(name)
9
+
10
+ const_get(name)
11
+ end
12
+
13
+ def self.to_a
14
+ constants.map(&:downcase)
15
+ end
16
+
17
+ def self.to_h
18
+ to_a.reduce({}) { |h, name| h.update(name => self[name]) }
19
+ end
20
+
21
+ # https://datatracker.ietf.org/doc/html/rfc9106#name-argon2-algorithm
22
+ # FIRST RECOMMENDED option per RFC 9106.
23
+ RFC_9106_HIGH_MEMORY = {
24
+ t_cost: 1,
25
+ m_cost: 21, # 2 GiB
26
+ p_cost: 4
27
+ }.freeze
28
+
29
+ # SECOND RECOMMENDED option per RFC 9106.
30
+ RFC_9106_LOW_MEMORY = {
31
+ t_cost: 3,
32
+ m_cost: 16, # 64 MiB
33
+ p_cost: 4
34
+ }.freeze
35
+
36
+ # The default values ruby-argon2 had before using RFC 9106 recommendations
37
+ PRE_RFC_9106 = {
38
+ t_cost: 2,
39
+ m_cost: 16, # 64 MiB
40
+ p_cost: 1
41
+ }.freeze
42
+
43
+ # Only use for fast testing. Insecure otherwise!
44
+ UNSAFE_CHEAPEST = {
45
+ t_cost: 1,
46
+ m_cost: 3, # 8 KiB
47
+ p_cost: 1
48
+ }.freeze
49
+ end
50
+ end
@@ -3,5 +3,5 @@
3
3
  # Standard Gem version constant.
4
4
 
5
5
  module Argon2
6
- VERSION = "2.2.0"
6
+ VERSION = "2.3.1"
7
7
  end
data/lib/argon2.rb CHANGED
@@ -6,19 +6,26 @@ require 'argon2/version'
6
6
  require 'argon2/errors'
7
7
  require 'argon2/engine'
8
8
  require 'argon2/hash_format'
9
+ require 'argon2/profiles'
9
10
 
10
11
  module Argon2
11
12
  # Front-end API for the Argon2 module.
12
13
  class Password
13
- def initialize(options = {})
14
- @t_cost = options[:t_cost] || 2
15
- raise ArgonHashFail, "Invalid t_cost" if @t_cost < 1 || @t_cost > 750
14
+ # Expose constants for the options supported and default used for passwords.
15
+ DEFAULT_T_COST = Argon2::Profiles::RFC_9106_LOW_MEMORY[:t_cost]
16
+ DEFAULT_M_COST = Argon2::Profiles::RFC_9106_LOW_MEMORY[:m_cost]
17
+ DEFAULT_P_COST = Argon2::Profiles::RFC_9106_LOW_MEMORY[:p_cost]
18
+ MIN_T_COST = 1
19
+ MAX_T_COST = 750
20
+ MIN_M_COST = 3
21
+ MAX_M_COST = 31
22
+ MIN_P_COST = 1
23
+ MAX_P_COST = 8
16
24
 
17
- @m_cost = options[:m_cost] || 16
18
- raise ArgonHashFail, "Invalid m_cost" if @m_cost < 1 || @m_cost > 31
25
+ def initialize(options = {})
26
+ options.update(Profiles[options[:profile]]) if options.key?(:profile)
19
27
 
20
- @p_cost = options[:p_cost] || 1
21
- raise ArgonHashFail, "Invalid p_cost" if @p_cost < 1 || @p_cost > 8
28
+ init_costs(options)
22
29
 
23
30
  @salt_do_not_supply = options[:salt_do_not_supply]
24
31
  @secret = options[:secret]
@@ -50,5 +57,18 @@ module Argon2
50
57
 
51
58
  Argon2::Engine.argon2_verify(pass, hash, secret)
52
59
  end
60
+
61
+ protected
62
+
63
+ def init_costs(options = {})
64
+ @t_cost = options[:t_cost] || DEFAULT_T_COST
65
+ raise ArgonHashFail, "Invalid t_cost" if @t_cost < MIN_T_COST || @t_cost > MAX_T_COST
66
+
67
+ @m_cost = options[:m_cost] || DEFAULT_M_COST
68
+ raise ArgonHashFail, "Invalid m_cost" if @m_cost < MIN_M_COST || @m_cost > MAX_M_COST
69
+
70
+ @p_cost = options[:p_cost] || DEFAULT_P_COST
71
+ raise ArgonHashFail, "Invalid p_cost" if @p_cost < MIN_P_COST || @p_cost > MAX_P_COST
72
+ end
53
73
  end
54
74
  end
data/sig/argon2.rbs CHANGED
@@ -1,21 +1,41 @@
1
- # Classes
2
1
  module Argon2
2
+ # Front-end API for the Argon2 module.
3
3
  class Password
4
4
  @t_cost: Integer
5
5
  @m_cost: Integer
6
6
  @p_cost: Integer
7
7
  @salt: nil | String
8
8
  @secret: nil | String
9
+ @salt_do_not_supply: nil | String
10
+
11
+ # Expose constants for the options supported and default used for passwords.
12
+ DEFAULT_T_COST: 2
13
+
14
+ DEFAULT_M_COST: 16
15
+
16
+ DEFAULT_P_COST: 1
17
+
18
+ MIN_T_COST: 1
19
+
20
+ MAX_T_COST: 750
21
+
22
+ MIN_M_COST: 1
23
+
24
+ MAX_M_COST: 31
25
+
26
+ MIN_P_COST: 1
27
+
28
+ MAX_P_COST: 8
9
29
 
10
30
  def initialize: (?::Hash[untyped, untyped] options) -> void
31
+
11
32
  def create: (String pass) -> untyped
12
- def self.create: (String pass) -> untyped
13
- def self.valid_hash?: (string hash) -> Integer?
14
- def self.verify_password: (untyped pass, untyped hash, ?nil secret) -> untyped
15
- end
16
- class Engine
17
- def self.saltgen: () -> String
18
- end
19
- class ArgonHashFail < StandardError
33
+
34
+ # Helper class, just creates defaults and calls hash()
35
+ def self.create: (String pass, ?::Hash[untyped, untyped] options) -> String
36
+
37
+ def self.valid_hash?: (String hash) -> bool
38
+
39
+ def self.verify_password: (String pass, String hash, ?String|nil secret) -> bool
20
40
  end
21
41
  end
data/sig/engine.rbs ADDED
@@ -0,0 +1,9 @@
1
+ module Argon2
2
+ # SecureRandom is a Ruby module. I have no idea why steep now thinks it's an unknown constant, nor why rbs
3
+ # prototype has no interest in outputting this.
4
+ SecureRandom: untyped
5
+ # Generates a random, binary string for use as a salt.
6
+ class Engine
7
+ def self.saltgen: () -> untyped
8
+ end
9
+ end
data/sig/errors.rbs ADDED
@@ -0,0 +1,6 @@
1
+ module Argon2
2
+ class ArgonHashFail < StandardError
3
+ end
4
+
5
+ ERRORS: ::Array["ARGON2_OK" | "ARGON2_OUTPUT_PTR_NULL" | "ARGON2_OUTPUT_TOO_SHORT" | "ARGON2_OUTPUT_TOO_LONG" | "ARGON2_PWD_TOO_SHORT" | "ARGON2_PWD_TOO_LONG" | "ARGON2_SALT_TOO_SHORT" | "ARGON2_SALT_TOO_LONG" | "ARGON2_AD_TOO_SHORT" | "ARGON2_AD_TOO_LONG" | "ARGON2_SECRET_TOO_SHORT" | "ARGON2_SECRET_TOO_LONG" | "ARGON2_TIME_TOO_SMALL" | "ARGON2_TIME_TOO_LARGE" | "ARGON2_MEMORY_TOO_LITTLE" | "ARGON2_MEMORY_TOO_MUCH" | "ARGON2_LANES_TOO_FEW" | "ARGON2_LANES_TOO_MANY" | "ARGON2_PWD_PTR_MISMATCH" | "ARGON2_SALT_PTR_MISMATCH" | "ARGON2_SECRET_PTR_MISMATCH" | "ARGON2_AD_PTR_MISMATCH" | "ARGON2_MEMORY_ALLOCATION_ERROR" | "ARGON2_FREE_MEMORY_CBK_NULL" | "ARGON2_ALLOCATE_MEMORY_CBK_NULL" | "ARGON2_INCORRECT_PARAMETER" | "ARGON2_INCORRECT_TYPE" | "ARGON2_OUT_PTR_MISMATCH" | "ARGON2_THREADS_TOO_FEW" | "ARGON2_THREADS_TOO_MANY" | "ARGON2_MISSING_ARGS" | "ARGON2_ENCODING_FAIL" | "ARGON2_DECODING_FAIL" | "ARGON2_THREAD_FAIL"]
6
+ end
data/sig/ffi.rbs CHANGED
@@ -1,8 +1,8 @@
1
1
  module Argon2
2
2
  # Direct external bindings. Call these methods via the Engine class to ensure points are dealt with
3
- module Ext
4
- extend FFI::Library
5
- end
3
+ # module Ext
4
+ # extend FFI::Library
5
+ # end
6
6
 
7
7
  # The engine class shields users from the FFI interface.
8
8
  # It is generally not advised to directly use this class.
@@ -0,0 +1,31 @@
1
+ module Argon2
2
+ #
3
+ # Get the values from an Argon2 compatible string.
4
+ #
5
+ class HashFormat
6
+ attr_reader variant: untyped
7
+
8
+ attr_reader version: untyped
9
+
10
+ attr_reader t_cost: untyped
11
+
12
+ attr_reader m_cost: untyped
13
+
14
+ attr_reader p_cost: untyped
15
+
16
+ attr_reader salt: untyped
17
+
18
+ attr_reader checksum: untyped
19
+
20
+ # FIXME: Reduce complexity/AbcSize
21
+ # rubocop:disable Metrics/AbcSize
22
+ def initialize: (untyped digest) -> void
23
+
24
+ #
25
+ # Checks whether a given digest is a valid Argon2 hash.
26
+ #
27
+ # Supports 1 and argon2id formats.
28
+ #
29
+ def self.valid_hash?: (untyped digest) -> untyped
30
+ end
31
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: argon2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Technion
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-12-27 00:00:00.000000000 Z
10
+ date: 2025-02-03 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: ffi
@@ -128,14 +127,14 @@ dependencies:
128
127
  requirements:
129
128
  - - "~>"
130
129
  - !ruby/object:Gem::Version
131
- version: 1.2.1
130
+ version: 1.9.3
132
131
  type: :development
133
132
  prerelease: false
134
133
  version_requirements: !ruby/object:Gem::Requirement
135
134
  requirements:
136
135
  - - "~>"
137
136
  - !ruby/object:Gem::Version
138
- version: 1.2.1
137
+ version: 1.9.3
139
138
  description: Argon2 FFI binding
140
139
  email:
141
140
  - technion@lolware.net
@@ -162,105 +161,28 @@ files:
162
161
  - bin/test
163
162
  - ext/argon2_wrap/Makefile.real
164
163
  - ext/argon2_wrap/argon_wrap.c
165
- - ext/argon2_wrap/argon_wrap.o
166
164
  - ext/argon2_wrap/extconf.rb
167
165
  - ext/argon2_wrap/test.c
168
- - ext/phc-winner-argon2/.git
169
- - ext/phc-winner-argon2/.gitattributes
170
- - ext/phc-winner-argon2/.gitignore
171
- - ext/phc-winner-argon2/.travis.yml
172
- - ext/phc-winner-argon2/Argon2.sln
173
- - ext/phc-winner-argon2/CHANGELOG.md
174
- - ext/phc-winner-argon2/LICENSE
175
- - ext/phc-winner-argon2/Makefile
176
- - ext/phc-winner-argon2/Package.swift
177
- - ext/phc-winner-argon2/README.md
178
- - ext/phc-winner-argon2/appveyor.yml
179
- - ext/phc-winner-argon2/argon2-specs.pdf
180
- - ext/phc-winner-argon2/export.sh
181
- - ext/phc-winner-argon2/include/argon2.h
182
- - ext/phc-winner-argon2/kats/argon2d
183
- - ext/phc-winner-argon2/kats/argon2d.shasum
184
- - ext/phc-winner-argon2/kats/argon2d_v16
185
- - ext/phc-winner-argon2/kats/argon2d_v16.shasum
186
- - ext/phc-winner-argon2/kats/argon2i
187
- - ext/phc-winner-argon2/kats/argon2i.shasum
188
- - ext/phc-winner-argon2/kats/argon2i_v16
189
- - ext/phc-winner-argon2/kats/argon2i_v16.shasum
190
- - ext/phc-winner-argon2/kats/argon2id
191
- - ext/phc-winner-argon2/kats/argon2id.shasum
192
- - ext/phc-winner-argon2/kats/argon2id_v16
193
- - ext/phc-winner-argon2/kats/argon2id_v16.shasum
194
- - ext/phc-winner-argon2/kats/check-sums.ps1
195
- - ext/phc-winner-argon2/kats/check-sums.sh
196
- - ext/phc-winner-argon2/kats/test.ps1
197
- - ext/phc-winner-argon2/kats/test.sh
198
- - ext/phc-winner-argon2/latex/IEEEtran.cls
199
- - ext/phc-winner-argon2/latex/Makefile
200
- - ext/phc-winner-argon2/latex/argon2-specs.tex
201
- - ext/phc-winner-argon2/latex/pics/argon2-par.pdf
202
- - ext/phc-winner-argon2/latex/pics/compression.pdf
203
- - ext/phc-winner-argon2/latex/pics/generic.pdf
204
- - ext/phc-winner-argon2/latex/pics/power-distribution.jpg
205
- - ext/phc-winner-argon2/latex/tradeoff.bib
206
- - ext/phc-winner-argon2/libargon2.pc.in
207
- - ext/phc-winner-argon2/man/argon2.1
208
- - ext/phc-winner-argon2/src/argon2.c
209
- - ext/phc-winner-argon2/src/bench.c
210
- - ext/phc-winner-argon2/src/blake2/blake2-impl.h
211
- - ext/phc-winner-argon2/src/blake2/blake2.h
212
- - ext/phc-winner-argon2/src/blake2/blake2b.c
213
- - ext/phc-winner-argon2/src/blake2/blamka-round-opt.h
214
- - ext/phc-winner-argon2/src/blake2/blamka-round-ref.h
215
- - ext/phc-winner-argon2/src/core.c
216
- - ext/phc-winner-argon2/src/core.h
217
- - ext/phc-winner-argon2/src/encoding.c
218
- - ext/phc-winner-argon2/src/encoding.h
219
- - ext/phc-winner-argon2/src/genkat.c
220
- - ext/phc-winner-argon2/src/genkat.h
221
- - ext/phc-winner-argon2/src/opt.c
222
- - ext/phc-winner-argon2/src/ref.c
223
- - ext/phc-winner-argon2/src/run.c
224
- - ext/phc-winner-argon2/src/test.c
225
- - ext/phc-winner-argon2/src/thread.c
226
- - ext/phc-winner-argon2/src/thread.h
227
- - ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj
228
- - ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj.filters
229
- - ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj
230
- - ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj.filters
231
- - ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj
232
- - ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj.filters
233
- - ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj
234
- - ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj.filters
235
- - ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj
236
- - ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj.filters
237
- - ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj
238
- - ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj.filters
239
- - ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj
240
- - ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj.filters
241
- - ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj
242
- - ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj.filters
243
- - ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj
244
- - ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj.filters
245
- - ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj
246
- - ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj.filters
247
166
  - lib/argon2.rb
248
167
  - lib/argon2/constants.rb
249
168
  - lib/argon2/engine.rb
250
169
  - lib/argon2/errors.rb
251
170
  - lib/argon2/ffi_engine.rb
252
171
  - lib/argon2/hash_format.rb
172
+ - lib/argon2/profiles.rb
253
173
  - lib/argon2/version.rb
254
174
  - sig/argon2.rbs
255
175
  - sig/constants.rbs
176
+ - sig/engine.rbs
177
+ - sig/errors.rbs
256
178
  - sig/ffi.rbs
179
+ - sig/hash_format.rbs
257
180
  - sig/version.rbs
258
181
  homepage: https://github.com/technion/ruby-argon2
259
182
  licenses:
260
183
  - MIT
261
184
  metadata:
262
185
  rubygems_mfa_required: 'true'
263
- post_install_message:
264
186
  rdoc_options: []
265
187
  require_paths:
266
188
  - lib
@@ -275,8 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
197
  - !ruby/object:Gem::Version
276
198
  version: '0'
277
199
  requirements: []
278
- rubygems_version: 3.3.5
279
- signing_key:
200
+ rubygems_version: 3.6.2
280
201
  specification_version: 4
281
202
  summary: Argon2 Password hashing binding
282
203
  test_files: []
Binary file
@@ -1 +0,0 @@
1
- gitdir: ../../.git/modules/ext/phc-winner-argon2
@@ -1,10 +0,0 @@
1
- # Export ignore
2
- .gitattributes export-ignore
3
- .gitignore export-ignore
4
- .travis.yml export-ignore
5
- appveyor.yml export-ignore
6
- export.sh export-ignore
7
- latex/* export-ignore
8
-
9
- # Linguist documentation
10
- latex/* linguist-documentation
@@ -1,22 +0,0 @@
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
@@ -1,25 +0,0 @@
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)