sorcery-argon2 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +0 -2
  3. data/.rubocop.yml +34 -2
  4. data/CHANGELOG.md +4 -0
  5. data/MAINTAINING.md +8 -3
  6. data/bin/setup +3 -0
  7. data/ext/phc-winner-argon2/.gitattributes +10 -0
  8. data/ext/phc-winner-argon2/.gitignore +22 -0
  9. data/ext/phc-winner-argon2/.travis.yml +25 -0
  10. data/ext/phc-winner-argon2/Argon2.sln +158 -0
  11. data/ext/phc-winner-argon2/CHANGELOG.md +32 -0
  12. data/ext/phc-winner-argon2/LICENSE +314 -0
  13. data/ext/phc-winner-argon2/Makefile +255 -0
  14. data/ext/phc-winner-argon2/Package.swift +46 -0
  15. data/ext/phc-winner-argon2/README.md +303 -0
  16. data/ext/phc-winner-argon2/appveyor.yml +25 -0
  17. data/ext/phc-winner-argon2/argon2-specs.pdf +0 -0
  18. data/ext/phc-winner-argon2/export.sh +7 -0
  19. data/ext/phc-winner-argon2/include/argon2.h +437 -0
  20. data/ext/phc-winner-argon2/kats/argon2d +12304 -0
  21. data/ext/phc-winner-argon2/kats/argon2d.shasum +1 -0
  22. data/ext/phc-winner-argon2/kats/argon2d_v16 +12304 -0
  23. data/ext/phc-winner-argon2/kats/argon2d_v16.shasum +1 -0
  24. data/ext/phc-winner-argon2/kats/argon2i +12304 -0
  25. data/ext/phc-winner-argon2/kats/argon2i.shasum +1 -0
  26. data/ext/phc-winner-argon2/kats/argon2i_v16 +12304 -0
  27. data/ext/phc-winner-argon2/kats/argon2i_v16.shasum +1 -0
  28. data/ext/phc-winner-argon2/kats/argon2id +12304 -0
  29. data/ext/phc-winner-argon2/kats/argon2id.shasum +1 -0
  30. data/ext/phc-winner-argon2/kats/argon2id_v16 +12304 -0
  31. data/ext/phc-winner-argon2/kats/argon2id_v16.shasum +1 -0
  32. data/ext/phc-winner-argon2/kats/check-sums.ps1 +42 -0
  33. data/ext/phc-winner-argon2/kats/check-sums.sh +13 -0
  34. data/ext/phc-winner-argon2/kats/test.ps1 +50 -0
  35. data/ext/phc-winner-argon2/kats/test.sh +49 -0
  36. data/ext/phc-winner-argon2/latex/IEEEtran.cls +6347 -0
  37. data/ext/phc-winner-argon2/latex/Makefile +18 -0
  38. data/ext/phc-winner-argon2/latex/argon2-specs.tex +920 -0
  39. data/ext/phc-winner-argon2/latex/pics/argon2-par.pdf +0 -0
  40. data/ext/phc-winner-argon2/latex/pics/compression.pdf +0 -0
  41. data/ext/phc-winner-argon2/latex/pics/generic.pdf +0 -0
  42. data/ext/phc-winner-argon2/latex/pics/power-distribution.jpg +0 -0
  43. data/ext/phc-winner-argon2/latex/tradeoff.bib +822 -0
  44. data/ext/phc-winner-argon2/libargon2.pc.in +18 -0
  45. data/ext/phc-winner-argon2/man/argon2.1 +57 -0
  46. data/ext/phc-winner-argon2/src/argon2.c +452 -0
  47. data/ext/phc-winner-argon2/src/bench.c +111 -0
  48. data/ext/phc-winner-argon2/src/blake2/blake2-impl.h +156 -0
  49. data/ext/phc-winner-argon2/src/blake2/blake2.h +89 -0
  50. data/ext/phc-winner-argon2/src/blake2/blake2b.c +390 -0
  51. data/ext/phc-winner-argon2/src/blake2/blamka-round-opt.h +471 -0
  52. data/ext/phc-winner-argon2/src/blake2/blamka-round-ref.h +56 -0
  53. data/ext/phc-winner-argon2/src/core.c +648 -0
  54. data/ext/phc-winner-argon2/src/core.h +228 -0
  55. data/ext/phc-winner-argon2/src/encoding.c +463 -0
  56. data/ext/phc-winner-argon2/src/encoding.h +57 -0
  57. data/ext/phc-winner-argon2/src/genkat.c +213 -0
  58. data/ext/phc-winner-argon2/src/genkat.h +51 -0
  59. data/ext/phc-winner-argon2/src/opt.c +283 -0
  60. data/ext/phc-winner-argon2/src/ref.c +194 -0
  61. data/ext/phc-winner-argon2/src/run.c +337 -0
  62. data/ext/phc-winner-argon2/src/test.c +289 -0
  63. data/ext/phc-winner-argon2/src/thread.c +57 -0
  64. data/ext/phc-winner-argon2/src/thread.h +67 -0
  65. data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj +231 -0
  66. data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj.filters +69 -0
  67. data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj +231 -0
  68. data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj.filters +69 -0
  69. data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj +230 -0
  70. data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj.filters +66 -0
  71. data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj +244 -0
  72. data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj.filters +72 -0
  73. data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj +235 -0
  74. data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj.filters +69 -0
  75. data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj +243 -0
  76. data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj.filters +69 -0
  77. data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj +231 -0
  78. data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj.filters +69 -0
  79. data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj +230 -0
  80. data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj.filters +66 -0
  81. data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj +232 -0
  82. data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj.filters +72 -0
  83. data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj +231 -0
  84. data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj.filters +69 -0
  85. data/lib/argon2/ffi_engine.rb +4 -4
  86. data/lib/argon2/password.rb +11 -3
  87. data/lib/argon2/version.rb +1 -1
  88. metadata +84 -3
@@ -0,0 +1,72 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup>
4
+ <Filter Include="Source Files">
5
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7
+ </Filter>
8
+ <Filter Include="Header Files">
9
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11
+ </Filter>
12
+ <Filter Include="Resource Files">
13
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15
+ </Filter>
16
+ </ItemGroup>
17
+ <ItemGroup>
18
+ <ClInclude Include="..\..\include\argon2.h">
19
+ <Filter>Header Files</Filter>
20
+ </ClInclude>
21
+ <ClInclude Include="..\..\src\core.h">
22
+ <Filter>Header Files</Filter>
23
+ </ClInclude>
24
+ <ClInclude Include="..\..\src\encoding.h">
25
+ <Filter>Header Files</Filter>
26
+ </ClInclude>
27
+ <ClInclude Include="..\..\src\genkat.h">
28
+ <Filter>Header Files</Filter>
29
+ </ClInclude>
30
+ <ClInclude Include="..\..\src\ref.h">
31
+ <Filter>Header Files</Filter>
32
+ </ClInclude>
33
+ <ClInclude Include="..\..\src\thread.h">
34
+ <Filter>Header Files</Filter>
35
+ </ClInclude>
36
+ <ClInclude Include="..\..\src\blake2\blake2.h">
37
+ <Filter>Header Files</Filter>
38
+ </ClInclude>
39
+ <ClInclude Include="..\..\src\blake2\blake2-impl.h">
40
+ <Filter>Header Files</Filter>
41
+ </ClInclude>
42
+ <ClInclude Include="..\..\src\blake2\blamka-round-opt.h">
43
+ <Filter>Header Files</Filter>
44
+ </ClInclude>
45
+ <ClInclude Include="..\..\src\blake2\blamka-round-ref.h">
46
+ <Filter>Header Files</Filter>
47
+ </ClInclude>
48
+ </ItemGroup>
49
+ <ItemGroup>
50
+ <ClCompile Include="..\..\src\blake2\blake2b.c">
51
+ <Filter>Source Files</Filter>
52
+ </ClCompile>
53
+ <ClCompile Include="..\..\src\argon2.c">
54
+ <Filter>Source Files</Filter>
55
+ </ClCompile>
56
+ <ClCompile Include="..\..\src\core.c">
57
+ <Filter>Source Files</Filter>
58
+ </ClCompile>
59
+ <ClCompile Include="..\..\src\encoding.c">
60
+ <Filter>Source Files</Filter>
61
+ </ClCompile>
62
+ <ClCompile Include="..\..\src\genkat.c">
63
+ <Filter>Source Files</Filter>
64
+ </ClCompile>
65
+ <ClCompile Include="..\..\src\ref.c">
66
+ <Filter>Source Files</Filter>
67
+ </ClCompile>
68
+ <ClCompile Include="..\..\src\thread.c">
69
+ <Filter>Source Files</Filter>
70
+ </ClCompile>
71
+ </ItemGroup>
72
+ </Project>
@@ -0,0 +1,231 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug|Win32">
5
+ <Configuration>Debug</Configuration>
6
+ <Platform>Win32</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="ReleaseStatic|Win32">
9
+ <Configuration>ReleaseStatic</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ <ProjectConfiguration Include="ReleaseStatic|x64">
13
+ <Configuration>ReleaseStatic</Configuration>
14
+ <Platform>x64</Platform>
15
+ </ProjectConfiguration>
16
+ <ProjectConfiguration Include="Release|Win32">
17
+ <Configuration>Release</Configuration>
18
+ <Platform>Win32</Platform>
19
+ </ProjectConfiguration>
20
+ <ProjectConfiguration Include="Debug|x64">
21
+ <Configuration>Debug</Configuration>
22
+ <Platform>x64</Platform>
23
+ </ProjectConfiguration>
24
+ <ProjectConfiguration Include="Release|x64">
25
+ <Configuration>Release</Configuration>
26
+ <Platform>x64</Platform>
27
+ </ProjectConfiguration>
28
+ </ItemGroup>
29
+ <PropertyGroup Label="Globals">
30
+ <ProjectGuid>{8A1F7F84-34AF-4DB2-9D58-D4823DFE79E9}</ProjectGuid>
31
+ <RootNamespace>Argon2RefTestCI</RootNamespace>
32
+ <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
33
+ </PropertyGroup>
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>
42
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
43
+ <ConfigurationType>Application</ConfigurationType>
44
+ <UseDebugLibraries>true</UseDebugLibraries>
45
+ <CharacterSet>MultiByte</CharacterSet>
46
+ </PropertyGroup>
47
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
48
+ <ConfigurationType>Application</ConfigurationType>
49
+ <UseDebugLibraries>false</UseDebugLibraries>
50
+ <WholeProgramOptimization>true</WholeProgramOptimization>
51
+ <CharacterSet>MultiByte</CharacterSet>
52
+ </PropertyGroup>
53
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
54
+ <ConfigurationType>Application</ConfigurationType>
55
+ <UseDebugLibraries>false</UseDebugLibraries>
56
+ <WholeProgramOptimization>true</WholeProgramOptimization>
57
+ <CharacterSet>MultiByte</CharacterSet>
58
+ </PropertyGroup>
59
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
60
+ <ConfigurationType>Application</ConfigurationType>
61
+ <UseDebugLibraries>true</UseDebugLibraries>
62
+ <CharacterSet>MultiByte</CharacterSet>
63
+ </PropertyGroup>
64
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
65
+ <ConfigurationType>Application</ConfigurationType>
66
+ <UseDebugLibraries>false</UseDebugLibraries>
67
+ <WholeProgramOptimization>true</WholeProgramOptimization>
68
+ <CharacterSet>MultiByte</CharacterSet>
69
+ </PropertyGroup>
70
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="Configuration">
71
+ <ConfigurationType>Application</ConfigurationType>
72
+ <UseDebugLibraries>false</UseDebugLibraries>
73
+ <WholeProgramOptimization>true</WholeProgramOptimization>
74
+ <CharacterSet>MultiByte</CharacterSet>
75
+ </PropertyGroup>
76
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
77
+ <ImportGroup Label="ExtensionSettings">
78
+ </ImportGroup>
79
+ <ImportGroup Label="Shared">
80
+ </ImportGroup>
81
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
82
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
83
+ </ImportGroup>
84
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
85
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
86
+ </ImportGroup>
87
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="PropertySheets">
88
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
89
+ </ImportGroup>
90
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
91
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
92
+ </ImportGroup>
93
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
94
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
95
+ </ImportGroup>
96
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="PropertySheets">
97
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
98
+ </ImportGroup>
99
+ <PropertyGroup Label="UserMacros" />
100
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
101
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
102
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
103
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
104
+ </PropertyGroup>
105
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
106
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
107
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
108
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
109
+ </PropertyGroup>
110
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
111
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
112
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
113
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
114
+ </PropertyGroup>
115
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
116
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
117
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
118
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
119
+ </PropertyGroup>
120
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
121
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
122
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
123
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
124
+ </PropertyGroup>
125
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
126
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
127
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
128
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
129
+ </PropertyGroup>
130
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
131
+ <ClCompile>
132
+ <WarningLevel>Level3</WarningLevel>
133
+ <Optimization>Disabled</Optimization>
134
+ <SDLCheck>true</SDLCheck>
135
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
136
+ </ClCompile>
137
+ </ItemDefinitionGroup>
138
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
139
+ <ClCompile>
140
+ <WarningLevel>Level3</WarningLevel>
141
+ <Optimization>Disabled</Optimization>
142
+ <SDLCheck>true</SDLCheck>
143
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
144
+ </ClCompile>
145
+ </ItemDefinitionGroup>
146
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
147
+ <ClCompile>
148
+ <WarningLevel>Level3</WarningLevel>
149
+ <Optimization>MaxSpeed</Optimization>
150
+ <FunctionLevelLinking>true</FunctionLevelLinking>
151
+ <IntrinsicFunctions>true</IntrinsicFunctions>
152
+ <SDLCheck>true</SDLCheck>
153
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
154
+ </ClCompile>
155
+ <Link>
156
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
157
+ <OptimizeReferences>true</OptimizeReferences>
158
+ <GenerateDebugInformation>true</GenerateDebugInformation>
159
+ </Link>
160
+ </ItemDefinitionGroup>
161
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
162
+ <ClCompile>
163
+ <WarningLevel>Level3</WarningLevel>
164
+ <Optimization>MaxSpeed</Optimization>
165
+ <FunctionLevelLinking>true</FunctionLevelLinking>
166
+ <IntrinsicFunctions>true</IntrinsicFunctions>
167
+ <SDLCheck>true</SDLCheck>
168
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
169
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
170
+ </ClCompile>
171
+ <Link>
172
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
173
+ <OptimizeReferences>true</OptimizeReferences>
174
+ <GenerateDebugInformation>true</GenerateDebugInformation>
175
+ </Link>
176
+ </ItemDefinitionGroup>
177
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
178
+ <ClCompile>
179
+ <WarningLevel>Level3</WarningLevel>
180
+ <Optimization>MaxSpeed</Optimization>
181
+ <FunctionLevelLinking>true</FunctionLevelLinking>
182
+ <IntrinsicFunctions>true</IntrinsicFunctions>
183
+ <SDLCheck>true</SDLCheck>
184
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
185
+ </ClCompile>
186
+ <Link>
187
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
188
+ <OptimizeReferences>true</OptimizeReferences>
189
+ <GenerateDebugInformation>true</GenerateDebugInformation>
190
+ </Link>
191
+ </ItemDefinitionGroup>
192
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
193
+ <ClCompile>
194
+ <WarningLevel>Level3</WarningLevel>
195
+ <Optimization>MaxSpeed</Optimization>
196
+ <FunctionLevelLinking>true</FunctionLevelLinking>
197
+ <IntrinsicFunctions>true</IntrinsicFunctions>
198
+ <SDLCheck>true</SDLCheck>
199
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
200
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
201
+ </ClCompile>
202
+ <Link>
203
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
204
+ <OptimizeReferences>true</OptimizeReferences>
205
+ <GenerateDebugInformation>true</GenerateDebugInformation>
206
+ </Link>
207
+ </ItemDefinitionGroup>
208
+ <ItemGroup>
209
+ <ClCompile Include="..\..\src\argon2.c" />
210
+ <ClCompile Include="..\..\src\blake2\blake2b.c" />
211
+ <ClCompile Include="..\..\src\core.c" />
212
+ <ClCompile Include="..\..\src\encoding.c" />
213
+ <ClCompile Include="..\..\src\ref.c" />
214
+ <ClCompile Include="..\..\src\test.c" />
215
+ <ClCompile Include="..\..\src\thread.c" />
216
+ </ItemGroup>
217
+ <ItemGroup>
218
+ <ClInclude Include="..\..\include\argon2.h" />
219
+ <ClInclude Include="..\..\src\blake2\blake2-impl.h" />
220
+ <ClInclude Include="..\..\src\blake2\blake2.h" />
221
+ <ClInclude Include="..\..\src\blake2\blamka-round-opt.h" />
222
+ <ClInclude Include="..\..\src\blake2\blamka-round-ref.h" />
223
+ <ClInclude Include="..\..\src\core.h" />
224
+ <ClInclude Include="..\..\src\encoding.h" />
225
+ <ClInclude Include="..\..\src\ref.h" />
226
+ <ClInclude Include="..\..\src\thread.h" />
227
+ </ItemGroup>
228
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
229
+ <ImportGroup Label="ExtensionTargets">
230
+ </ImportGroup>
231
+ </Project>
@@ -0,0 +1,69 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup>
4
+ <Filter Include="Source Files">
5
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7
+ </Filter>
8
+ <Filter Include="Header Files">
9
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11
+ </Filter>
12
+ <Filter Include="Resource Files">
13
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15
+ </Filter>
16
+ </ItemGroup>
17
+ <ItemGroup>
18
+ <ClCompile Include="..\..\src\argon2.c">
19
+ <Filter>Source Files</Filter>
20
+ </ClCompile>
21
+ <ClCompile Include="..\..\src\core.c">
22
+ <Filter>Source Files</Filter>
23
+ </ClCompile>
24
+ <ClCompile Include="..\..\src\encoding.c">
25
+ <Filter>Source Files</Filter>
26
+ </ClCompile>
27
+ <ClCompile Include="..\..\src\ref.c">
28
+ <Filter>Source Files</Filter>
29
+ </ClCompile>
30
+ <ClCompile Include="..\..\src\test.c">
31
+ <Filter>Source Files</Filter>
32
+ </ClCompile>
33
+ <ClCompile Include="..\..\src\thread.c">
34
+ <Filter>Source Files</Filter>
35
+ </ClCompile>
36
+ <ClCompile Include="..\..\src\blake2\blake2b.c">
37
+ <Filter>Source Files</Filter>
38
+ </ClCompile>
39
+ </ItemGroup>
40
+ <ItemGroup>
41
+ <ClInclude Include="..\..\include\argon2.h">
42
+ <Filter>Header Files</Filter>
43
+ </ClInclude>
44
+ <ClInclude Include="..\..\src\blake2\blake2.h">
45
+ <Filter>Header Files</Filter>
46
+ </ClInclude>
47
+ <ClInclude Include="..\..\src\blake2\blake2-impl.h">
48
+ <Filter>Header Files</Filter>
49
+ </ClInclude>
50
+ <ClInclude Include="..\..\src\core.h">
51
+ <Filter>Header Files</Filter>
52
+ </ClInclude>
53
+ <ClInclude Include="..\..\src\encoding.h">
54
+ <Filter>Header Files</Filter>
55
+ </ClInclude>
56
+ <ClInclude Include="..\..\src\ref.h">
57
+ <Filter>Header Files</Filter>
58
+ </ClInclude>
59
+ <ClInclude Include="..\..\src\thread.h">
60
+ <Filter>Header Files</Filter>
61
+ </ClInclude>
62
+ <ClInclude Include="..\..\src\blake2\blamka-round-opt.h">
63
+ <Filter>Header Files</Filter>
64
+ </ClInclude>
65
+ <ClInclude Include="..\..\src\blake2\blamka-round-ref.h">
66
+ <Filter>Header Files</Filter>
67
+ </ClInclude>
68
+ </ItemGroup>
69
+ </Project>
@@ -67,13 +67,13 @@ module Argon2
67
67
  result.unpack('H*').join
68
68
  end
69
69
 
70
- def self.hash_argon2id(password, salt, t_cost, m_cost, out_len = nil)
70
+ def self.hash_argon2id(password, salt, t_cost, m_cost, p_cost, out_len = nil)
71
71
  out_len = (out_len || Constants::OUT_LEN).to_i
72
72
  raise ::Argon2::Errors::InvalidOutputLength if out_len < 1
73
73
 
74
74
  result = ''
75
75
  FFI::MemoryPointer.new(:char, out_len) do |buffer|
76
- ret = Ext.argon2id_hash_raw(t_cost, 1 << m_cost, 1, password,
76
+ ret = Ext.argon2id_hash_raw(t_cost, 1 << m_cost, p_cost, password,
77
77
  password.length, salt, salt.length,
78
78
  buffer, out_len)
79
79
  raise ::Argon2::Errors::ExtError, ERRORS[ret.abs] unless ret.zero?
@@ -83,7 +83,7 @@ module Argon2
83
83
  result.unpack('H*').join
84
84
  end
85
85
 
86
- def self.hash_argon2id_encode(password, salt, t_cost, m_cost, secret)
86
+ def self.hash_argon2id_encode(password, salt, t_cost, m_cost, p_cost, secret)
87
87
  result = ''
88
88
  secretlen = secret.nil? ? 0 : secret.bytesize
89
89
  passwordlen = password.nil? ? 0 : password.bytesize
@@ -92,7 +92,7 @@ module Argon2
92
92
  FFI::MemoryPointer.new(:char, Constants::ENCODE_LEN) do |buffer|
93
93
  ret = Ext.argon2_wrap(buffer, password, passwordlen,
94
94
  salt, salt.length, t_cost, (1 << m_cost),
95
- 1, secret, secretlen)
95
+ p_cost, secret, secretlen)
96
96
  raise ::Argon2::Errors::ExtError, ERRORS[ret.abs] unless ret.zero?
97
97
 
98
98
  result = buffer.read_string(Constants::ENCODE_LEN)
@@ -19,6 +19,13 @@ module Argon2
19
19
  MIN_M_COST = 3
20
20
  # Used to validate the maximum acceptable memory cost
21
21
  MAX_M_COST = 31
22
+ # Used as the default parallelism cost if one isn't provided when calling
23
+ # Argon2::Password.create
24
+ DEFAULT_P_COST = 1
25
+ # Used to validate the minimum acceptable parallelism cost
26
+ MIN_P_COST = 1
27
+ # Used to validate the maximum acceptable parallelism cost
28
+ MAX_P_COST = 8
22
29
  # The complete Argon2 digest string (not to be confused with the checksum).
23
30
  attr_reader :digest
24
31
  # The hash portion of the stored password hash.
@@ -55,6 +62,7 @@ module Argon2
55
62
  #
56
63
  # * :t_cost
57
64
  # * :m_cost
65
+ # * :p_cost
58
66
  # * :secret
59
67
  #
60
68
  def create(password, options = {})
@@ -62,18 +70,18 @@ module Argon2
62
70
 
63
71
  t_cost = options[:t_cost] || DEFAULT_T_COST
64
72
  m_cost = options[:m_cost] || DEFAULT_M_COST
73
+ p_cost = options[:p_cost] || DEFAULT_P_COST
65
74
 
66
75
  raise Argon2::Errors::InvalidTCost if t_cost < MIN_T_COST || t_cost > MAX_T_COST
67
76
  raise Argon2::Errors::InvalidMCost if m_cost < MIN_M_COST || m_cost > MAX_M_COST
68
-
69
- # TODO: Add support for changing the p_cost
77
+ raise Argon2::Errors::InvalidPCost if p_cost < MIN_P_COST || p_cost > MAX_P_COST
70
78
 
71
79
  salt = Engine.saltgen
72
80
  secret = options[:secret]
73
81
 
74
82
  Argon2::Password.new(
75
83
  Argon2::Engine.hash_argon2id_encode(
76
- password, salt, t_cost, m_cost, secret
84
+ password, salt, t_cost, m_cost, p_cost, secret
77
85
  )
78
86
  )
79
87
  end