argon2 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +16 -0
- data/.github/workflows/ruby.yml +32 -0
- data/.rubocop.yml +150 -5
- data/Changelog.md +3 -0
- data/Gemfile +2 -0
- data/README.md +8 -7
- data/Rakefile +2 -0
- data/argon2.gemspec +9 -6
- data/bin/console +1 -0
- data/ext/argon2_wrap/argon_wrap.c +2 -0
- data/ext/argon2_wrap/extconf.rb +1 -0
- data/ext/phc-winner-argon2/.gitignore +1 -0
- data/ext/phc-winner-argon2/Argon2.sln +2 -4
- data/ext/phc-winner-argon2/LICENSE +2 -2
- data/ext/phc-winner-argon2/Makefile +86 -18
- data/ext/phc-winner-argon2/README.md +3 -1
- data/ext/phc-winner-argon2/include/argon2.h +3 -3
- data/ext/phc-winner-argon2/libargon2.pc.in +18 -0
- data/ext/phc-winner-argon2/src/argon2.c +2 -2
- data/ext/phc-winner-argon2/src/bench.c +4 -4
- data/ext/phc-winner-argon2/src/blake2/blake2-impl.h +3 -3
- data/ext/phc-winner-argon2/src/blake2/blake2.h +2 -2
- data/ext/phc-winner-argon2/src/blake2/blake2b.c +2 -2
- data/ext/phc-winner-argon2/src/blake2/blamka-round-opt.h +2 -2
- data/ext/phc-winner-argon2/src/blake2/blamka-round-ref.h +2 -2
- data/ext/phc-winner-argon2/src/core.c +20 -6
- data/ext/phc-winner-argon2/src/core.h +2 -2
- data/ext/phc-winner-argon2/src/encoding.c +2 -2
- data/ext/phc-winner-argon2/src/encoding.h +2 -2
- data/ext/phc-winner-argon2/src/genkat.c +9 -3
- data/ext/phc-winner-argon2/src/genkat.h +2 -2
- data/ext/phc-winner-argon2/src/opt.c +2 -2
- data/ext/phc-winner-argon2/src/ref.c +2 -2
- data/ext/phc-winner-argon2/src/run.c +2 -2
- data/ext/phc-winner-argon2/src/test.c +2 -2
- data/ext/phc-winner-argon2/src/thread.c +2 -2
- data/ext/phc-winner-argon2/src/thread.h +2 -2
- data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj +11 -6
- data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj +11 -6
- data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj +11 -6
- data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj +11 -6
- data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj +16 -8
- data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj +25 -8
- data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj +11 -6
- data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj +11 -6
- data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj +11 -6
- data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj +11 -6
- data/lib/argon2.rb +4 -2
- data/lib/argon2/ffi_engine.rb +31 -21
- data/lib/argon2/version.rb +1 -1
- metadata +40 -31
- data/.travis.yml +0 -13
- data/ext/phc-winner-argon2/libargon2.pc +0 -16
@@ -32,43 +32,44 @@
|
|
32
32
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
33
33
|
</PropertyGroup>
|
34
34
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
35
|
+
<!-- Set DefaultPlatformToolset to v100 (VS2010) if not defined -->
|
36
|
+
<PropertyGroup Label="EmptyDefaultPlatformToolset">
|
37
|
+
<DefaultPlatformToolset Condition=" '$(DefaultPlatformToolset)' == '' ">v100</DefaultPlatformToolset>
|
38
|
+
</PropertyGroup>
|
39
|
+
<PropertyGroup Label="PlatformToolset">
|
40
|
+
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
41
|
+
</PropertyGroup>
|
35
42
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
36
43
|
<ConfigurationType>Application</ConfigurationType>
|
37
44
|
<UseDebugLibraries>true</UseDebugLibraries>
|
38
|
-
<PlatformToolset>v140</PlatformToolset>
|
39
45
|
<CharacterSet>MultiByte</CharacterSet>
|
40
46
|
</PropertyGroup>
|
41
47
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
42
48
|
<ConfigurationType>Application</ConfigurationType>
|
43
49
|
<UseDebugLibraries>false</UseDebugLibraries>
|
44
|
-
<PlatformToolset>v140</PlatformToolset>
|
45
50
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
46
51
|
<CharacterSet>MultiByte</CharacterSet>
|
47
52
|
</PropertyGroup>
|
48
53
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
|
49
54
|
<ConfigurationType>Application</ConfigurationType>
|
50
55
|
<UseDebugLibraries>false</UseDebugLibraries>
|
51
|
-
<PlatformToolset>v140</PlatformToolset>
|
52
56
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
53
57
|
<CharacterSet>MultiByte</CharacterSet>
|
54
58
|
</PropertyGroup>
|
55
59
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
56
60
|
<ConfigurationType>Application</ConfigurationType>
|
57
61
|
<UseDebugLibraries>true</UseDebugLibraries>
|
58
|
-
<PlatformToolset>v140</PlatformToolset>
|
59
62
|
<CharacterSet>MultiByte</CharacterSet>
|
60
63
|
</PropertyGroup>
|
61
64
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
62
65
|
<ConfigurationType>Application</ConfigurationType>
|
63
66
|
<UseDebugLibraries>false</UseDebugLibraries>
|
64
|
-
<PlatformToolset>v140</PlatformToolset>
|
65
67
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
66
68
|
<CharacterSet>MultiByte</CharacterSet>
|
67
69
|
</PropertyGroup>
|
68
70
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="Configuration">
|
69
71
|
<ConfigurationType>Application</ConfigurationType>
|
70
72
|
<UseDebugLibraries>false</UseDebugLibraries>
|
71
|
-
<PlatformToolset>v140</PlatformToolset>
|
72
73
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
73
74
|
<CharacterSet>MultiByte</CharacterSet>
|
74
75
|
</PropertyGroup>
|
@@ -154,6 +155,7 @@
|
|
154
155
|
<Link>
|
155
156
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
156
157
|
<OptimizeReferences>true</OptimizeReferences>
|
158
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
157
159
|
</Link>
|
158
160
|
</ItemDefinitionGroup>
|
159
161
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
|
@@ -169,6 +171,7 @@
|
|
169
171
|
<Link>
|
170
172
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
171
173
|
<OptimizeReferences>true</OptimizeReferences>
|
174
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
172
175
|
</Link>
|
173
176
|
</ItemDefinitionGroup>
|
174
177
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
@@ -183,6 +186,7 @@
|
|
183
186
|
<Link>
|
184
187
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
185
188
|
<OptimizeReferences>true</OptimizeReferences>
|
189
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
186
190
|
</Link>
|
187
191
|
</ItemDefinitionGroup>
|
188
192
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
|
@@ -198,6 +202,7 @@
|
|
198
202
|
<Link>
|
199
203
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
200
204
|
<OptimizeReferences>true</OptimizeReferences>
|
205
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
201
206
|
</Link>
|
202
207
|
</ItemDefinitionGroup>
|
203
208
|
<ItemGroup>
|
@@ -32,43 +32,44 @@
|
|
32
32
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
33
33
|
</PropertyGroup>
|
34
34
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
35
|
+
<!-- Set DefaultPlatformToolset to v100 (VS2010) if not defined -->
|
36
|
+
<PropertyGroup Label="EmptyDefaultPlatformToolset">
|
37
|
+
<DefaultPlatformToolset Condition=" '$(DefaultPlatformToolset)' == '' ">v100</DefaultPlatformToolset>
|
38
|
+
</PropertyGroup>
|
39
|
+
<PropertyGroup Label="PlatformToolset">
|
40
|
+
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
41
|
+
</PropertyGroup>
|
35
42
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
36
43
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
37
44
|
<UseDebugLibraries>true</UseDebugLibraries>
|
38
|
-
<PlatformToolset>v140</PlatformToolset>
|
39
45
|
<CharacterSet>MultiByte</CharacterSet>
|
40
46
|
</PropertyGroup>
|
41
47
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
42
48
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
43
49
|
<UseDebugLibraries>false</UseDebugLibraries>
|
44
|
-
<PlatformToolset>v140</PlatformToolset>
|
45
50
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
46
51
|
<CharacterSet>MultiByte</CharacterSet>
|
47
52
|
</PropertyGroup>
|
48
53
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
|
49
54
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
50
55
|
<UseDebugLibraries>false</UseDebugLibraries>
|
51
|
-
<PlatformToolset>v140</PlatformToolset>
|
52
56
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
53
57
|
<CharacterSet>MultiByte</CharacterSet>
|
54
58
|
</PropertyGroup>
|
55
59
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
56
60
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
57
61
|
<UseDebugLibraries>true</UseDebugLibraries>
|
58
|
-
<PlatformToolset>v140</PlatformToolset>
|
59
62
|
<CharacterSet>MultiByte</CharacterSet>
|
60
63
|
</PropertyGroup>
|
61
64
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
62
65
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
63
66
|
<UseDebugLibraries>false</UseDebugLibraries>
|
64
|
-
<PlatformToolset>v140</PlatformToolset>
|
65
67
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
66
68
|
<CharacterSet>MultiByte</CharacterSet>
|
67
69
|
</PropertyGroup>
|
68
70
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="Configuration">
|
69
71
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
70
72
|
<UseDebugLibraries>false</UseDebugLibraries>
|
71
|
-
<PlatformToolset>v140</PlatformToolset>
|
72
73
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
73
74
|
<CharacterSet>MultiByte</CharacterSet>
|
74
75
|
</PropertyGroup>
|
@@ -154,6 +155,7 @@
|
|
154
155
|
<Link>
|
155
156
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
156
157
|
<OptimizeReferences>true</OptimizeReferences>
|
158
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
157
159
|
</Link>
|
158
160
|
</ItemDefinitionGroup>
|
159
161
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
|
@@ -169,6 +171,7 @@
|
|
169
171
|
<Link>
|
170
172
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
171
173
|
<OptimizeReferences>true</OptimizeReferences>
|
174
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
172
175
|
</Link>
|
173
176
|
</ItemDefinitionGroup>
|
174
177
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
@@ -183,6 +186,7 @@
|
|
183
186
|
<Link>
|
184
187
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
185
188
|
<OptimizeReferences>true</OptimizeReferences>
|
189
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
186
190
|
</Link>
|
187
191
|
</ItemDefinitionGroup>
|
188
192
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
|
@@ -198,6 +202,7 @@
|
|
198
202
|
<Link>
|
199
203
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
200
204
|
<OptimizeReferences>true</OptimizeReferences>
|
205
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
201
206
|
</Link>
|
202
207
|
</ItemDefinitionGroup>
|
203
208
|
<ItemGroup>
|
@@ -32,43 +32,44 @@
|
|
32
32
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
33
33
|
</PropertyGroup>
|
34
34
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
35
|
+
<!-- Set DefaultPlatformToolset to v100 (VS2010) if not defined -->
|
36
|
+
<PropertyGroup Label="EmptyDefaultPlatformToolset">
|
37
|
+
<DefaultPlatformToolset Condition=" '$(DefaultPlatformToolset)' == '' ">v100</DefaultPlatformToolset>
|
38
|
+
</PropertyGroup>
|
39
|
+
<PropertyGroup Label="PlatformToolset">
|
40
|
+
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
41
|
+
</PropertyGroup>
|
35
42
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
36
43
|
<ConfigurationType>Application</ConfigurationType>
|
37
44
|
<UseDebugLibraries>true</UseDebugLibraries>
|
38
|
-
<PlatformToolset>v140</PlatformToolset>
|
39
45
|
<CharacterSet>MultiByte</CharacterSet>
|
40
46
|
</PropertyGroup>
|
41
47
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
42
48
|
<ConfigurationType>Application</ConfigurationType>
|
43
49
|
<UseDebugLibraries>false</UseDebugLibraries>
|
44
|
-
<PlatformToolset>v140</PlatformToolset>
|
45
50
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
46
51
|
<CharacterSet>MultiByte</CharacterSet>
|
47
52
|
</PropertyGroup>
|
48
53
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
|
49
54
|
<ConfigurationType>Application</ConfigurationType>
|
50
55
|
<UseDebugLibraries>false</UseDebugLibraries>
|
51
|
-
<PlatformToolset>v140</PlatformToolset>
|
52
56
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
53
57
|
<CharacterSet>MultiByte</CharacterSet>
|
54
58
|
</PropertyGroup>
|
55
59
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
56
60
|
<ConfigurationType>Application</ConfigurationType>
|
57
61
|
<UseDebugLibraries>true</UseDebugLibraries>
|
58
|
-
<PlatformToolset>v140</PlatformToolset>
|
59
62
|
<CharacterSet>MultiByte</CharacterSet>
|
60
63
|
</PropertyGroup>
|
61
64
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
62
65
|
<ConfigurationType>Application</ConfigurationType>
|
63
66
|
<UseDebugLibraries>false</UseDebugLibraries>
|
64
|
-
<PlatformToolset>v140</PlatformToolset>
|
65
67
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
66
68
|
<CharacterSet>MultiByte</CharacterSet>
|
67
69
|
</PropertyGroup>
|
68
70
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="Configuration">
|
69
71
|
<ConfigurationType>Application</ConfigurationType>
|
70
72
|
<UseDebugLibraries>false</UseDebugLibraries>
|
71
|
-
<PlatformToolset>v140</PlatformToolset>
|
72
73
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
73
74
|
<CharacterSet>MultiByte</CharacterSet>
|
74
75
|
</PropertyGroup>
|
@@ -154,6 +155,7 @@
|
|
154
155
|
<Link>
|
155
156
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
156
157
|
<OptimizeReferences>true</OptimizeReferences>
|
158
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
157
159
|
</Link>
|
158
160
|
</ItemDefinitionGroup>
|
159
161
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
|
@@ -169,6 +171,7 @@
|
|
169
171
|
<Link>
|
170
172
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
171
173
|
<OptimizeReferences>true</OptimizeReferences>
|
174
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
172
175
|
</Link>
|
173
176
|
</ItemDefinitionGroup>
|
174
177
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
@@ -183,6 +186,7 @@
|
|
183
186
|
<Link>
|
184
187
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
185
188
|
<OptimizeReferences>true</OptimizeReferences>
|
189
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
186
190
|
</Link>
|
187
191
|
</ItemDefinitionGroup>
|
188
192
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
|
@@ -198,6 +202,7 @@
|
|
198
202
|
<Link>
|
199
203
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
200
204
|
<OptimizeReferences>true</OptimizeReferences>
|
205
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
201
206
|
</Link>
|
202
207
|
</ItemDefinitionGroup>
|
203
208
|
<ItemGroup>
|
@@ -32,43 +32,44 @@
|
|
32
32
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
33
33
|
</PropertyGroup>
|
34
34
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
35
|
+
<!-- Set DefaultPlatformToolset to v100 (VS2010) if not defined -->
|
36
|
+
<PropertyGroup Label="EmptyDefaultPlatformToolset">
|
37
|
+
<DefaultPlatformToolset Condition=" '$(DefaultPlatformToolset)' == '' ">v100</DefaultPlatformToolset>
|
38
|
+
</PropertyGroup>
|
39
|
+
<PropertyGroup Label="PlatformToolset">
|
40
|
+
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
41
|
+
</PropertyGroup>
|
35
42
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
36
43
|
<ConfigurationType>Application</ConfigurationType>
|
37
44
|
<UseDebugLibraries>true</UseDebugLibraries>
|
38
|
-
<PlatformToolset>v140</PlatformToolset>
|
39
45
|
<CharacterSet>MultiByte</CharacterSet>
|
40
46
|
</PropertyGroup>
|
41
47
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
42
48
|
<ConfigurationType>Application</ConfigurationType>
|
43
49
|
<UseDebugLibraries>false</UseDebugLibraries>
|
44
|
-
<PlatformToolset>v140</PlatformToolset>
|
45
50
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
46
51
|
<CharacterSet>MultiByte</CharacterSet>
|
47
52
|
</PropertyGroup>
|
48
53
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
|
49
54
|
<ConfigurationType>Application</ConfigurationType>
|
50
55
|
<UseDebugLibraries>false</UseDebugLibraries>
|
51
|
-
<PlatformToolset>v140</PlatformToolset>
|
52
56
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
53
57
|
<CharacterSet>MultiByte</CharacterSet>
|
54
58
|
</PropertyGroup>
|
55
59
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
56
60
|
<ConfigurationType>Application</ConfigurationType>
|
57
61
|
<UseDebugLibraries>true</UseDebugLibraries>
|
58
|
-
<PlatformToolset>v140</PlatformToolset>
|
59
62
|
<CharacterSet>MultiByte</CharacterSet>
|
60
63
|
</PropertyGroup>
|
61
64
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
62
65
|
<ConfigurationType>Application</ConfigurationType>
|
63
66
|
<UseDebugLibraries>false</UseDebugLibraries>
|
64
|
-
<PlatformToolset>v140</PlatformToolset>
|
65
67
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
66
68
|
<CharacterSet>MultiByte</CharacterSet>
|
67
69
|
</PropertyGroup>
|
68
70
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="Configuration">
|
69
71
|
<ConfigurationType>Application</ConfigurationType>
|
70
72
|
<UseDebugLibraries>false</UseDebugLibraries>
|
71
|
-
<PlatformToolset>v140</PlatformToolset>
|
72
73
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
73
74
|
<CharacterSet>MultiByte</CharacterSet>
|
74
75
|
</PropertyGroup>
|
@@ -154,6 +155,7 @@
|
|
154
155
|
<Link>
|
155
156
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
156
157
|
<OptimizeReferences>true</OptimizeReferences>
|
158
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
157
159
|
</Link>
|
158
160
|
</ItemDefinitionGroup>
|
159
161
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
|
@@ -169,6 +171,7 @@
|
|
169
171
|
<Link>
|
170
172
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
171
173
|
<OptimizeReferences>true</OptimizeReferences>
|
174
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
172
175
|
</Link>
|
173
176
|
</ItemDefinitionGroup>
|
174
177
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
@@ -183,6 +186,7 @@
|
|
183
186
|
<Link>
|
184
187
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
185
188
|
<OptimizeReferences>true</OptimizeReferences>
|
189
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
186
190
|
</Link>
|
187
191
|
</ItemDefinitionGroup>
|
188
192
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
|
@@ -198,6 +202,7 @@
|
|
198
202
|
<Link>
|
199
203
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
200
204
|
<OptimizeReferences>true</OptimizeReferences>
|
205
|
+
<GenerateDebugInformation>true</GenerateDebugInformation>
|
201
206
|
</Link>
|
202
207
|
</ItemDefinitionGroup>
|
203
208
|
<ItemGroup>
|
data/lib/argon2.rb
CHANGED
@@ -4,7 +4,7 @@ require 'argon2/constants'
|
|
4
4
|
require 'argon2/ffi_engine'
|
5
5
|
require 'argon2/version'
|
6
6
|
require 'argon2/errors'
|
7
|
-
require 'argon2/engine
|
7
|
+
require 'argon2/engine'
|
8
8
|
|
9
9
|
module Argon2
|
10
10
|
# Front-end API for the Argon2 module.
|
@@ -12,8 +12,10 @@ module Argon2
|
|
12
12
|
def initialize(options = {})
|
13
13
|
@t_cost = options[:t_cost] || 2
|
14
14
|
raise ArgonHashFail, "Invalid t_cost" if @t_cost < 1 || @t_cost > 750
|
15
|
+
|
15
16
|
@m_cost = options[:m_cost] || 16
|
16
17
|
raise ArgonHashFail, "Invalid m_cost" if @m_cost < 1 || @m_cost > 31
|
18
|
+
|
17
19
|
@salt = options[:salt_do_not_supply] || Engine.saltgen
|
18
20
|
@secret = options[:secret]
|
19
21
|
end
|
@@ -23,7 +25,7 @@ module Argon2
|
|
23
25
|
pass.is_a?(String)
|
24
26
|
|
25
27
|
Argon2::Engine.hash_argon2id_encode(
|
26
|
-
|
28
|
+
pass, @salt, @t_cost, @m_cost, @secret)
|
27
29
|
end
|
28
30
|
|
29
31
|
# Helper class, just creates defaults and calls hash()
|
data/lib/argon2/ffi_engine.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'ffi'
|
2
4
|
require 'ffi-compiler/loader'
|
3
5
|
|
@@ -5,37 +7,40 @@ module Argon2
|
|
5
7
|
# Direct external bindings. Call these methods via the Engine class to ensure points are dealt with
|
6
8
|
module Ext
|
7
9
|
extend FFI::Library
|
8
|
-
ffi_lib FFI::Compiler::Loader.find('argon2_wrap')
|
10
|
+
ffi_lib FFI::Compiler::Loader.find(FFI::Platform.windows? ? 'libargon2_wrap' : 'argon2_wrap')
|
9
11
|
|
10
12
|
# int argon2i_hash_raw(const uint32_t t_cost, const uint32_t m_cost,
|
11
13
|
# const uint32_t parallelism, const void *pwd,
|
12
14
|
# const size_t pwdlen, const void *salt,
|
13
15
|
# const size_t saltlen, void *hash, const size_t hashlen);
|
14
16
|
|
15
|
-
attach_function :argon2i_hash_raw, [
|
16
|
-
|
17
|
-
|
17
|
+
attach_function :argon2i_hash_raw, %i[
|
18
|
+
uint uint uint pointer
|
19
|
+
size_t pointer size_t pointer size_t
|
20
|
+
], :int, :blocking => true
|
18
21
|
|
19
22
|
# int argon2id_hash_raw(const uint32_t t_cost, const uint32_t m_cost,
|
20
23
|
# const uint32_t parallelism, const void *pwd,
|
21
24
|
# const size_t pwdlen, const void *salt,
|
22
25
|
# const size_t saltlen, void *hash, const size_t hashlen)
|
23
|
-
attach_function :argon2id_hash_raw, [
|
24
|
-
|
25
|
-
|
26
|
+
attach_function :argon2id_hash_raw, %i[
|
27
|
+
uint uint uint pointer
|
28
|
+
size_t pointer size_t pointer size_t
|
29
|
+
], :int, :blocking => true
|
26
30
|
|
27
31
|
# void argon2_wrap(uint8_t *out, char *pwd, size_t pwdlen,
|
28
32
|
# uint8_t *salt, uint32_t saltlen, uint32_t t_cost,
|
29
33
|
# uint32_t m_cost, uint32_t lanes,
|
30
34
|
# uint8_t *secret, uint32_t secretlen)
|
31
|
-
attach_function :argon2_wrap, [
|
32
|
-
|
33
|
-
|
35
|
+
attach_function :argon2_wrap, %i[
|
36
|
+
pointer pointer size_t pointer uint uint
|
37
|
+
uint uint pointer size_t
|
38
|
+
], :int, :blocking => true
|
34
39
|
|
35
40
|
# int argon2i_verify(const char *encoded, const void *pwd,
|
36
41
|
# const size_t pwdlen);
|
37
|
-
attach_function :wrap_argon2_verify, [
|
38
|
-
|
42
|
+
attach_function :wrap_argon2_verify, %i[pointer pointer size_t
|
43
|
+
pointer size_t], :int, :blocking => true
|
39
44
|
end
|
40
45
|
|
41
46
|
# The engine class shields users from the FFI interface.
|
@@ -44,12 +49,14 @@ module Argon2
|
|
44
49
|
def self.hash_argon2i(password, salt, t_cost, m_cost, out_len = nil)
|
45
50
|
out_len = (out_len || Constants::OUT_LEN).to_i
|
46
51
|
raise ArgonHashFail, "Invalid output length" if out_len < 1
|
52
|
+
|
47
53
|
result = ''
|
48
54
|
FFI::MemoryPointer.new(:char, out_len) do |buffer|
|
49
55
|
ret = Ext.argon2i_hash_raw(t_cost, 1 << m_cost, 1, password,
|
50
|
-
|
51
|
-
|
56
|
+
password.length, salt, salt.length,
|
57
|
+
buffer, out_len)
|
52
58
|
raise ArgonHashFail, ERRORS[ret.abs] unless ret.zero?
|
59
|
+
|
53
60
|
result = buffer.read_string(out_len)
|
54
61
|
end
|
55
62
|
result.unpack('H*').join
|
@@ -58,12 +65,14 @@ module Argon2
|
|
58
65
|
def self.hash_argon2id(password, salt, t_cost, m_cost, out_len = nil)
|
59
66
|
out_len = (out_len || Constants::OUT_LEN).to_i
|
60
67
|
raise ArgonHashFail, "Invalid output length" if out_len < 1
|
68
|
+
|
61
69
|
result = ''
|
62
70
|
FFI::MemoryPointer.new(:char, out_len) do |buffer|
|
63
71
|
ret = Ext.argon2id_hash_raw(t_cost, 1 << m_cost, 1, password,
|
64
|
-
|
65
|
-
|
72
|
+
password.length, salt, salt.length,
|
73
|
+
buffer, out_len)
|
66
74
|
raise ArgonHashFail, ERRORS[ret.abs] unless ret.zero?
|
75
|
+
|
67
76
|
result = buffer.read_string(out_len)
|
68
77
|
end
|
69
78
|
result.unpack('H*').join
|
@@ -73,14 +82,14 @@ module Argon2
|
|
73
82
|
result = ''
|
74
83
|
secretlen = secret.nil? ? 0 : secret.bytesize
|
75
84
|
passwordlen = password.nil? ? 0 : password.bytesize
|
76
|
-
if salt.length != Constants::SALT_LEN
|
77
|
-
|
78
|
-
end
|
85
|
+
raise ArgonHashFail, "Invalid salt size" if salt.length != Constants::SALT_LEN
|
86
|
+
|
79
87
|
FFI::MemoryPointer.new(:char, Constants::ENCODE_LEN) do |buffer|
|
80
88
|
ret = Ext.argon2_wrap(buffer, password, passwordlen,
|
81
|
-
|
82
|
-
|
89
|
+
salt, salt.length, t_cost, (1 << m_cost),
|
90
|
+
1, secret, secretlen)
|
83
91
|
raise ArgonHashFail, ERRORS[ret.abs] unless ret.zero?
|
92
|
+
|
84
93
|
result = buffer.read_string(Constants::ENCODE_LEN)
|
85
94
|
end
|
86
95
|
result.delete "\0"
|
@@ -93,6 +102,7 @@ module Argon2
|
|
93
102
|
ret = Ext.wrap_argon2_verify(hash, pwd, passwordlen, secret, secretlen)
|
94
103
|
return false if ERRORS[ret.abs] == 'ARGON2_DECODING_FAIL'
|
95
104
|
raise ArgonHashFail, ERRORS[ret.abs] unless ret.zero?
|
105
|
+
|
96
106
|
true
|
97
107
|
end
|
98
108
|
end
|