enzoic 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +3 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +5 -0
  7. data/README.md +90 -0
  8. data/Rakefile +28 -0
  9. data/enzoic.gemspec +36 -0
  10. data/ext/.DS_Store +0 -0
  11. data/ext/argon2-wrapper/Makefile +74 -0
  12. data/ext/argon2-wrapper/argon2-wrapper.c +165 -0
  13. data/ext/argon2-wrapper/extconf.rb +1 -0
  14. data/ext/argon2_import/.DS_Store +0 -0
  15. data/ext/digest/whirlpool/extconf.rb +10 -0
  16. data/ext/digest/whirlpool/whirlpool-algorithm.c +476 -0
  17. data/ext/digest/whirlpool/whirlpool-algorithm.h +86 -0
  18. data/ext/digest/whirlpool/whirlpool-constants.h +1116 -0
  19. data/ext/digest/whirlpool/whirlpool-portability.h +142 -0
  20. data/ext/digest/whirlpool/whirlpool.c +51 -0
  21. data/ext/phc-winner-argon2/.gitattributes +10 -0
  22. data/ext/phc-winner-argon2/.gitignore +21 -0
  23. data/ext/phc-winner-argon2/.travis.yml +14 -0
  24. data/ext/phc-winner-argon2/Argon2.sln +160 -0
  25. data/ext/phc-winner-argon2/CHANGELOG.md +25 -0
  26. data/ext/phc-winner-argon2/LICENSE +314 -0
  27. data/ext/phc-winner-argon2/Makefile +187 -0
  28. data/ext/phc-winner-argon2/README.md +290 -0
  29. data/ext/phc-winner-argon2/appveyor.yml +25 -0
  30. data/ext/phc-winner-argon2/argon2-specs.pdf +0 -0
  31. data/ext/phc-winner-argon2/export.sh +7 -0
  32. data/ext/phc-winner-argon2/include/argon2.h +435 -0
  33. data/ext/phc-winner-argon2/kats/argon2d +12304 -0
  34. data/ext/phc-winner-argon2/kats/argon2d.shasum +1 -0
  35. data/ext/phc-winner-argon2/kats/argon2d_v16 +12304 -0
  36. data/ext/phc-winner-argon2/kats/argon2d_v16.shasum +1 -0
  37. data/ext/phc-winner-argon2/kats/argon2i +12304 -0
  38. data/ext/phc-winner-argon2/kats/argon2i.shasum +1 -0
  39. data/ext/phc-winner-argon2/kats/argon2i_v16 +12304 -0
  40. data/ext/phc-winner-argon2/kats/argon2i_v16.shasum +1 -0
  41. data/ext/phc-winner-argon2/kats/argon2id +12304 -0
  42. data/ext/phc-winner-argon2/kats/argon2id.shasum +1 -0
  43. data/ext/phc-winner-argon2/kats/argon2id_v16 +12304 -0
  44. data/ext/phc-winner-argon2/kats/argon2id_v16.shasum +1 -0
  45. data/ext/phc-winner-argon2/kats/check-sums.ps1 +42 -0
  46. data/ext/phc-winner-argon2/kats/check-sums.sh +13 -0
  47. data/ext/phc-winner-argon2/kats/test.ps1 +50 -0
  48. data/ext/phc-winner-argon2/kats/test.sh +49 -0
  49. data/ext/phc-winner-argon2/latex/IEEEtran.cls +6347 -0
  50. data/ext/phc-winner-argon2/latex/Makefile +18 -0
  51. data/ext/phc-winner-argon2/latex/argon2-specs.tex +920 -0
  52. data/ext/phc-winner-argon2/latex/pics/argon2-par.pdf +0 -0
  53. data/ext/phc-winner-argon2/latex/pics/compression.pdf +0 -0
  54. data/ext/phc-winner-argon2/latex/pics/generic.pdf +0 -0
  55. data/ext/phc-winner-argon2/latex/pics/power-distribution.jpg +0 -0
  56. data/ext/phc-winner-argon2/latex/tradeoff.bib +822 -0
  57. data/ext/phc-winner-argon2/libargon2.pc +16 -0
  58. data/ext/phc-winner-argon2/man/argon2.1 +57 -0
  59. data/ext/phc-winner-argon2/src/argon2.c +452 -0
  60. data/ext/phc-winner-argon2/src/bench.c +111 -0
  61. data/ext/phc-winner-argon2/src/blake2/blake2-impl.h +156 -0
  62. data/ext/phc-winner-argon2/src/blake2/blake2.h +91 -0
  63. data/ext/phc-winner-argon2/src/blake2/blake2b.c +390 -0
  64. data/ext/phc-winner-argon2/src/blake2/blamka-round-opt.h +328 -0
  65. data/ext/phc-winner-argon2/src/blake2/blamka-round-ref.h +56 -0
  66. data/ext/phc-winner-argon2/src/core.c +635 -0
  67. data/ext/phc-winner-argon2/src/core.h +227 -0
  68. data/ext/phc-winner-argon2/src/encoding.c +463 -0
  69. data/ext/phc-winner-argon2/src/encoding.h +57 -0
  70. data/ext/phc-winner-argon2/src/genkat.c +208 -0
  71. data/ext/phc-winner-argon2/src/genkat.h +49 -0
  72. data/ext/phc-winner-argon2/src/opt.c +241 -0
  73. data/ext/phc-winner-argon2/src/ref.c +194 -0
  74. data/ext/phc-winner-argon2/src/run.c +317 -0
  75. data/ext/phc-winner-argon2/src/test.c +254 -0
  76. data/ext/phc-winner-argon2/src/thread.c +57 -0
  77. data/ext/phc-winner-argon2/src/thread.h +67 -0
  78. data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj +226 -0
  79. data/ext/phc-winner-argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj.filters +69 -0
  80. data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj +226 -0
  81. data/ext/phc-winner-argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj.filters +69 -0
  82. data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj +225 -0
  83. data/ext/phc-winner-argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj.filters +66 -0
  84. data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj +239 -0
  85. data/ext/phc-winner-argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj.filters +72 -0
  86. data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj +227 -0
  87. data/ext/phc-winner-argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj.filters +69 -0
  88. data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj +226 -0
  89. data/ext/phc-winner-argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj.filters +69 -0
  90. data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj +226 -0
  91. data/ext/phc-winner-argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj.filters +69 -0
  92. data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj +225 -0
  93. data/ext/phc-winner-argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj.filters +66 -0
  94. data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj +227 -0
  95. data/ext/phc-winner-argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj.filters +72 -0
  96. data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj +226 -0
  97. data/ext/phc-winner-argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj.filters +69 -0
  98. data/lib/enzoic.rb +189 -0
  99. data/lib/enzoic/argon2_errors.rb +39 -0
  100. data/lib/enzoic/argon2_wrapper_ffi.rb +89 -0
  101. data/lib/enzoic/constants.rb +10 -0
  102. data/lib/enzoic/errors.rb +3 -0
  103. data/lib/enzoic/hashing.rb +258 -0
  104. data/lib/enzoic/password_type.rb +25 -0
  105. data/lib/enzoic/version.rb +5 -0
  106. metadata +354 -0
@@ -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,226 @@
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
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
36
+ <ConfigurationType>Application</ConfigurationType>
37
+ <UseDebugLibraries>true</UseDebugLibraries>
38
+ <PlatformToolset>v140</PlatformToolset>
39
+ <CharacterSet>MultiByte</CharacterSet>
40
+ </PropertyGroup>
41
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
42
+ <ConfigurationType>Application</ConfigurationType>
43
+ <UseDebugLibraries>false</UseDebugLibraries>
44
+ <PlatformToolset>v140</PlatformToolset>
45
+ <WholeProgramOptimization>true</WholeProgramOptimization>
46
+ <CharacterSet>MultiByte</CharacterSet>
47
+ </PropertyGroup>
48
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
49
+ <ConfigurationType>Application</ConfigurationType>
50
+ <UseDebugLibraries>false</UseDebugLibraries>
51
+ <PlatformToolset>v140</PlatformToolset>
52
+ <WholeProgramOptimization>true</WholeProgramOptimization>
53
+ <CharacterSet>MultiByte</CharacterSet>
54
+ </PropertyGroup>
55
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
56
+ <ConfigurationType>Application</ConfigurationType>
57
+ <UseDebugLibraries>true</UseDebugLibraries>
58
+ <PlatformToolset>v140</PlatformToolset>
59
+ <CharacterSet>MultiByte</CharacterSet>
60
+ </PropertyGroup>
61
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
62
+ <ConfigurationType>Application</ConfigurationType>
63
+ <UseDebugLibraries>false</UseDebugLibraries>
64
+ <PlatformToolset>v140</PlatformToolset>
65
+ <WholeProgramOptimization>true</WholeProgramOptimization>
66
+ <CharacterSet>MultiByte</CharacterSet>
67
+ </PropertyGroup>
68
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="Configuration">
69
+ <ConfigurationType>Application</ConfigurationType>
70
+ <UseDebugLibraries>false</UseDebugLibraries>
71
+ <PlatformToolset>v140</PlatformToolset>
72
+ <WholeProgramOptimization>true</WholeProgramOptimization>
73
+ <CharacterSet>MultiByte</CharacterSet>
74
+ </PropertyGroup>
75
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
76
+ <ImportGroup Label="ExtensionSettings">
77
+ </ImportGroup>
78
+ <ImportGroup Label="Shared">
79
+ </ImportGroup>
80
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
81
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
82
+ </ImportGroup>
83
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
84
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
85
+ </ImportGroup>
86
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="PropertySheets">
87
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
88
+ </ImportGroup>
89
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
90
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
91
+ </ImportGroup>
92
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
93
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
94
+ </ImportGroup>
95
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'" Label="PropertySheets">
96
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
97
+ </ImportGroup>
98
+ <PropertyGroup Label="UserMacros" />
99
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
100
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
101
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
102
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
103
+ </PropertyGroup>
104
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
105
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
106
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
107
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
108
+ </PropertyGroup>
109
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
110
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
111
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
112
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
113
+ </PropertyGroup>
114
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
115
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
116
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
117
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
118
+ </PropertyGroup>
119
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
120
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
121
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
122
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
123
+ </PropertyGroup>
124
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
125
+ <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
126
+ <OutDir>$(SolutionDir)vs2015\build\</OutDir>
127
+ <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
128
+ </PropertyGroup>
129
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
130
+ <ClCompile>
131
+ <WarningLevel>Level3</WarningLevel>
132
+ <Optimization>Disabled</Optimization>
133
+ <SDLCheck>true</SDLCheck>
134
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
135
+ </ClCompile>
136
+ </ItemDefinitionGroup>
137
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
138
+ <ClCompile>
139
+ <WarningLevel>Level3</WarningLevel>
140
+ <Optimization>Disabled</Optimization>
141
+ <SDLCheck>true</SDLCheck>
142
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
143
+ </ClCompile>
144
+ </ItemDefinitionGroup>
145
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
146
+ <ClCompile>
147
+ <WarningLevel>Level3</WarningLevel>
148
+ <Optimization>MaxSpeed</Optimization>
149
+ <FunctionLevelLinking>true</FunctionLevelLinking>
150
+ <IntrinsicFunctions>true</IntrinsicFunctions>
151
+ <SDLCheck>true</SDLCheck>
152
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
153
+ </ClCompile>
154
+ <Link>
155
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
156
+ <OptimizeReferences>true</OptimizeReferences>
157
+ </Link>
158
+ </ItemDefinitionGroup>
159
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
160
+ <ClCompile>
161
+ <WarningLevel>Level3</WarningLevel>
162
+ <Optimization>MaxSpeed</Optimization>
163
+ <FunctionLevelLinking>true</FunctionLevelLinking>
164
+ <IntrinsicFunctions>true</IntrinsicFunctions>
165
+ <SDLCheck>true</SDLCheck>
166
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
167
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
168
+ </ClCompile>
169
+ <Link>
170
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
171
+ <OptimizeReferences>true</OptimizeReferences>
172
+ </Link>
173
+ </ItemDefinitionGroup>
174
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
175
+ <ClCompile>
176
+ <WarningLevel>Level3</WarningLevel>
177
+ <Optimization>MaxSpeed</Optimization>
178
+ <FunctionLevelLinking>true</FunctionLevelLinking>
179
+ <IntrinsicFunctions>true</IntrinsicFunctions>
180
+ <SDLCheck>true</SDLCheck>
181
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
182
+ </ClCompile>
183
+ <Link>
184
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
185
+ <OptimizeReferences>true</OptimizeReferences>
186
+ </Link>
187
+ </ItemDefinitionGroup>
188
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|x64'">
189
+ <ClCompile>
190
+ <WarningLevel>Level3</WarningLevel>
191
+ <Optimization>MaxSpeed</Optimization>
192
+ <FunctionLevelLinking>true</FunctionLevelLinking>
193
+ <IntrinsicFunctions>true</IntrinsicFunctions>
194
+ <SDLCheck>true</SDLCheck>
195
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
196
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
197
+ </ClCompile>
198
+ <Link>
199
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
200
+ <OptimizeReferences>true</OptimizeReferences>
201
+ </Link>
202
+ </ItemDefinitionGroup>
203
+ <ItemGroup>
204
+ <ClCompile Include="..\..\src\argon2.c" />
205
+ <ClCompile Include="..\..\src\blake2\blake2b.c" />
206
+ <ClCompile Include="..\..\src\core.c" />
207
+ <ClCompile Include="..\..\src\encoding.c" />
208
+ <ClCompile Include="..\..\src\ref.c" />
209
+ <ClCompile Include="..\..\src\test.c" />
210
+ <ClCompile Include="..\..\src\thread.c" />
211
+ </ItemGroup>
212
+ <ItemGroup>
213
+ <ClInclude Include="..\..\include\argon2.h" />
214
+ <ClInclude Include="..\..\src\blake2\blake2-impl.h" />
215
+ <ClInclude Include="..\..\src\blake2\blake2.h" />
216
+ <ClInclude Include="..\..\src\blake2\blamka-round-opt.h" />
217
+ <ClInclude Include="..\..\src\blake2\blamka-round-ref.h" />
218
+ <ClInclude Include="..\..\src\core.h" />
219
+ <ClInclude Include="..\..\src\encoding.h" />
220
+ <ClInclude Include="..\..\src\ref.h" />
221
+ <ClInclude Include="..\..\src\thread.h" />
222
+ </ItemGroup>
223
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
224
+ <ImportGroup Label="ExtensionTargets">
225
+ </ImportGroup>
226
+ </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>
@@ -0,0 +1,189 @@
1
+ require 'enzoic/errors'
2
+ require 'enzoic/constants'
3
+ require 'enzoic/password_type'
4
+ require 'enzoic/hashing'
5
+ require 'cgi'
6
+ require 'base64'
7
+ require 'rest-client'
8
+ require 'json'
9
+ require 'ostruct'
10
+
11
+ module Enzoic
12
+ # This is the main entry point for accessing Enzoic.
13
+ #
14
+ # Create this class with your API Key and Secret and then call the desired methods on the class
15
+ # to access the Enzoic API.
16
+ class Enzoic
17
+ def initialize(options = {})
18
+ @apiKey = options[:apiKey] || '';
19
+ raise EnzoicFail, "No API key provided" if @apiKey == ''
20
+ @secret = options[:secret] || '';
21
+ raise EnzoicFail, "No Secret provided" if @secret == ''
22
+ @baseURL = options[:baseURL] || "https://api.enzoic.com/v1"
23
+ @authString = calc_auth_string(@apiKey, @secret)
24
+ end
25
+
26
+ def check_credentials(username, password)
27
+ raise EnzoicFail, "API key/Secret not set" if !@authString || @authString == ''
28
+
29
+ response = make_rest_call(@baseURL + Constants::ACCOUNTS_API_PATH + "?username=" + Hashing.sha256(username), "GET", nil)
30
+
31
+ if (response == "404")
32
+ return false
33
+ end
34
+
35
+ account_response = JSON.parse(response)
36
+ hashes_required = account_response["passwordHashesRequired"]
37
+
38
+ bcrypt_count = 0
39
+ query_string = ""
40
+
41
+ for i in 0..hashes_required.length - 1 do
42
+ hash_spec = hashes_required[i]
43
+
44
+ # bcrypt gets far too expensive for good response time if there are many of them to calculate.
45
+ # some mostly garbage accounts have accumulated a number of them in our DB and if we happen to hit one it
46
+ # kills performance, so short circuit out after at most 2 BCrypt hashes
47
+ if (hash_spec["hashType"] != PasswordType::BCrypt || bcrypt_count <= 2)
48
+ if (hash_spec["hashType"] == PasswordType::BCrypt)
49
+ bcrypt_count = bcrypt_count + 1
50
+ end
51
+
52
+ if (hash_spec["hashType"] != nil)
53
+ credential_hash = calc_credential_hash(username, password, account_response["salt"], hash_spec);
54
+
55
+ if (credential_hash != nil)
56
+ if (query_string.length == 0)
57
+ query_string = query_string + "?hashes=" + CGI.escape(credential_hash);
58
+ else
59
+ query_string = query_string + "&hashes=" + CGI.escape(credential_hash);
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ if (query_string.length > 0)
67
+ creds_response = make_rest_call(
68
+ @baseURL + Constants::CREDENTIALS_API_PATH + query_string, "GET", nil)
69
+ return creds_response != "404"
70
+ end
71
+
72
+ return false
73
+ end
74
+
75
+ def check_password(password)
76
+ response = make_rest_call(
77
+ @baseURL + Constants::PASSWORDS_API_PATH +
78
+ "?md5=" + Hashing.md5(password) +
79
+ "&sha1=" + Hashing.sha1(password) +
80
+ "&sha256=" + Hashing.sha256(password),
81
+ "GET", nil)
82
+
83
+ return response != "404"
84
+ end
85
+
86
+ def get_exposures_for_user(username)
87
+ response = make_rest_call(@baseURL + Constants::EXPOSURES_API_PATH + "?username=" + Hashing.sha256(username),
88
+ "GET", nil)
89
+
90
+ if (response == "404")
91
+ # don't have this email in the DB - return empty response
92
+ return JSON.parse('{ "count": 0, "exposures": [] }', object_class: OpenStruct)
93
+ else
94
+ # deserialize response
95
+ return JSON.parse(response, object_class: OpenStruct)
96
+ end
97
+ end
98
+
99
+ def get_exposure_details(exposure_id)
100
+ response = make_rest_call(@baseURL + Constants::EXPOSURES_API_PATH + "?id=" + CGI.escape(exposure_id),
101
+ "GET", nil)
102
+
103
+ if (response != "404")
104
+ # deserialize response
105
+ return JSON.parse(response, object_class: OpenStruct)
106
+ else
107
+ return nil
108
+ end
109
+ end
110
+
111
+ private
112
+ def make_rest_call(rest_url, method, body)
113
+ begin
114
+ response = RestClient::Request.execute(method: method, url: rest_url,
115
+ headers: { content_type: :json, accept: :json, authorization: @authString })
116
+ return response.body
117
+ rescue RestClient::NotFound
118
+ return "404"
119
+ end
120
+ end
121
+
122
+ def calc_credential_hash(username, password, salt, hash_spec)
123
+ password_hash = calc_password_hash(hash_spec["hashType"], password, hash_spec["salt"])
124
+
125
+ if (password_hash != nil)
126
+ return Hashing.argon2_raw(username + "$" + password_hash, salt)
127
+ else
128
+ return nil
129
+ end
130
+ end
131
+
132
+ def calc_password_hash(password_type, password, salt)
133
+ case password_type
134
+ when PasswordType::MD5
135
+ return Hashing.md5(password)
136
+ when PasswordType::SHA1
137
+ return Hashing.sha1(password)
138
+ when PasswordType::SHA256
139
+ return Hashing.sha256(password)
140
+ when PasswordType::SHA512
141
+ return Hashing.sha512(password)
142
+ when PasswordType::IPBoard_MyBB
143
+ if (salt != nil && salt.length > 0)
144
+ return Hashing.mybb(password, salt)
145
+ end
146
+ when PasswordType::VBulletinPre3_8_5
147
+ if (salt != nil && salt.length > 0)
148
+ return Hashing.vbulletin(password, salt)
149
+ end
150
+ when PasswordType::VBulletinPost3_8_5
151
+ if (salt != nil && salt.length > 0)
152
+ return Hashing.vbulletin(password, salt)
153
+ end
154
+ when PasswordType::BCrypt
155
+ if (salt != nil && salt.length > 0)
156
+ return Hashing.bcrypt(password, salt)
157
+ end
158
+ when PasswordType::CRC32
159
+ return Hashing.crc32(password)
160
+ when PasswordType::PHPBB3
161
+ if (salt != nil && salt.length > 0)
162
+ return Hashing.phpbb3(password, salt)
163
+ end
164
+ when PasswordType::CustomAlgorithm1
165
+ if (salt != nil && salt.length > 0)
166
+ return Hashing.custom_algorithm1(password, salt)
167
+ end
168
+ when PasswordType::CustomAlgorithm2
169
+ if (salt != nil && salt.length > 0)
170
+ return Hashing.custom_algorithm2(password, salt)
171
+ end
172
+ when PasswordType::MD5Crypt
173
+ if (salt != nil && salt.length > 0)
174
+ return Hashing.md5crypt(password, salt)
175
+ end
176
+ when PasswordType::CustomAlgorithm4
177
+ if (salt != nil && salt.length > 0)
178
+ return Hashing.custom_algorithm4(password, salt)
179
+ end
180
+ end
181
+
182
+ return nil
183
+ end
184
+
185
+ def calc_auth_string(apiKey, secret)
186
+ return "basic " + Base64.strict_encode64(apiKey + ":" + secret);
187
+ end
188
+ end
189
+ end