@leocuvee/wrkzcoin-multi-hashing 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/.travis.yml +5 -0
  2. package/LICENSE +674 -0
  3. package/README.md +87 -0
  4. package/appveyor.yml +12 -0
  5. package/argon2/.gitattributes +10 -0
  6. package/argon2/.travis.yml +25 -0
  7. package/argon2/Argon2.sln +160 -0
  8. package/argon2/CHANGELOG.md +32 -0
  9. package/argon2/CMakeLists.txt +87 -0
  10. package/argon2/LICENSE +314 -0
  11. package/argon2/Makefile +196 -0
  12. package/argon2/README.md +297 -0
  13. package/argon2/appveyor.yml +40 -0
  14. package/argon2/argon2-specs.pdf +0 -0
  15. package/argon2/export.sh +7 -0
  16. package/argon2/include/argon2.h +427 -0
  17. package/argon2/latex/CMakeLists.txt +34 -0
  18. package/argon2/latex/IEEEtran.cls +6347 -0
  19. package/argon2/latex/Makefile +18 -0
  20. package/argon2/latex/argon2-specs.tex +920 -0
  21. package/argon2/latex/pics/argon2-par.pdf +0 -0
  22. package/argon2/latex/pics/compression.pdf +0 -0
  23. package/argon2/latex/pics/generic.pdf +0 -0
  24. package/argon2/latex/pics/power-distribution.jpg +0 -0
  25. package/argon2/latex/tradeoff.bib +822 -0
  26. package/argon2/libargon2.pc +16 -0
  27. package/argon2/man/CMakeLists.txt +8 -0
  28. package/argon2/man/argon2.1 +57 -0
  29. package/argon2/meson.build +16 -0
  30. package/argon2/meson_options.txt +1 -0
  31. package/argon2/src/CMakeLists.txt +147 -0
  32. package/argon2/src/argon2.c +452 -0
  33. package/argon2/src/argon2.pc.in +11 -0
  34. package/argon2/src/blake2/blake2-impl.h +156 -0
  35. package/argon2/src/blake2/blake2.h +89 -0
  36. package/argon2/src/blake2/blake2b.c +390 -0
  37. package/argon2/src/blake2/blamka-round-opt.h +471 -0
  38. package/argon2/src/blake2/blamka-round-ref.h +56 -0
  39. package/argon2/src/core.c +634 -0
  40. package/argon2/src/core.h +228 -0
  41. package/argon2/src/encoding.c +467 -0
  42. package/argon2/src/encoding.h +57 -0
  43. package/argon2/src/genkat.h +51 -0
  44. package/argon2/src/meson.build +68 -0
  45. package/argon2/src/opt.c +283 -0
  46. package/argon2/src/optimization/CMakeLists.txt +10 -0
  47. package/argon2/src/ref.c +194 -0
  48. package/argon2/src/thread.c +57 -0
  49. package/argon2/src/thread.h +67 -0
  50. package/argon2/tests/CMakeLists.txt +43 -0
  51. package/argon2/tests/bench.c +111 -0
  52. package/argon2/tests/genkat.c +207 -0
  53. package/argon2/tests/kats/argon2d +12304 -0
  54. package/argon2/tests/kats/argon2d.shasum +1 -0
  55. package/argon2/tests/kats/argon2d_v16 +12304 -0
  56. package/argon2/tests/kats/argon2d_v16.shasum +1 -0
  57. package/argon2/tests/kats/argon2i +12304 -0
  58. package/argon2/tests/kats/argon2i.shasum +1 -0
  59. package/argon2/tests/kats/argon2i_v16 +12304 -0
  60. package/argon2/tests/kats/argon2i_v16.shasum +1 -0
  61. package/argon2/tests/kats/argon2id +12304 -0
  62. package/argon2/tests/kats/argon2id.shasum +1 -0
  63. package/argon2/tests/kats/argon2id_v16 +12304 -0
  64. package/argon2/tests/kats/argon2id_v16.shasum +1 -0
  65. package/argon2/tests/kats/check-sums.ps1 +48 -0
  66. package/argon2/tests/kats/check-sums.sh +16 -0
  67. package/argon2/tests/kats/test.ps1 +132 -0
  68. package/argon2/tests/kats/test.sh +117 -0
  69. package/argon2/tests/meson.build +34 -0
  70. package/argon2/tests/test.c +289 -0
  71. package/argon2/tool/CMakeLists.txt +7 -0
  72. package/argon2/tool/main.c +339 -0
  73. package/argon2/tool/meson.build +8 -0
  74. package/argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj +226 -0
  75. package/argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj.filters +69 -0
  76. package/argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj +226 -0
  77. package/argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj.filters +69 -0
  78. package/argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj +225 -0
  79. package/argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj.filters +66 -0
  80. package/argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj +239 -0
  81. package/argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj.filters +72 -0
  82. package/argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj +227 -0
  83. package/argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj.filters +69 -0
  84. package/argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj +226 -0
  85. package/argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj.filters +69 -0
  86. package/argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj +226 -0
  87. package/argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj.filters +69 -0
  88. package/argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj +225 -0
  89. package/argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj.filters +66 -0
  90. package/argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj +227 -0
  91. package/argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj.filters +72 -0
  92. package/argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj +226 -0
  93. package/argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj.filters +69 -0
  94. package/bcrypt.c +566 -0
  95. package/bcrypt.h +14 -0
  96. package/binding.gyp +93 -0
  97. package/blake.c +17 -0
  98. package/blake.h +16 -0
  99. package/boolberry.cc +11 -0
  100. package/boolberry.h +6 -0
  101. package/build/Makefile +354 -0
  102. package/build/Release/.deps/Release/multihashing.node.d +1 -0
  103. package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/argon2.o.d +8 -0
  104. package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/blake2/blake2b.o.d +8 -0
  105. package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/core.o.d +10 -0
  106. package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/encoding.o.d +8 -0
  107. package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/ref.o.d +14 -0
  108. package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/thread.o.d +5 -0
  109. package/build/Release/.deps/Release/obj.target/multihashing/bcrypt.o.d +4 -0
  110. package/build/Release/.deps/Release/obj.target/multihashing/blake.o.d +7 -0
  111. package/build/Release/.deps/Release/obj.target/multihashing/boolberry.o.d +12 -0
  112. package/build/Release/.deps/Release/obj.target/multihashing/c11.o.d +20 -0
  113. package/build/Release/.deps/Release/obj.target/multihashing/crypto/aesb.o.d +3 -0
  114. package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_blake256.o.d +5 -0
  115. package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_groestl.o.d +10 -0
  116. package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_jh.o.d +9 -0
  117. package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_keccak.o.d +7 -0
  118. package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_skein.o.d +10 -0
  119. package/build/Release/.deps/Release/obj.target/multihashing/crypto/hash.o.d +7 -0
  120. package/build/Release/.deps/Release/obj.target/multihashing/crypto/oaes_lib.o.d +6 -0
  121. package/build/Release/.deps/Release/obj.target/multihashing/crypto/wild_keccak.o.d +8 -0
  122. package/build/Release/.deps/Release/obj.target/multihashing/cryptonight.o.d +18 -0
  123. package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_dark.o.d +18 -0
  124. package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_dark_lite.o.d +18 -0
  125. package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_fast.o.d +18 -0
  126. package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_lite.o.d +18 -0
  127. package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_soft_shell.o.d +18 -0
  128. package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_turtle.o.d +18 -0
  129. package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_turtle_lite.o.d +18 -0
  130. package/build/Release/.deps/Release/obj.target/multihashing/fresh.o.d +10 -0
  131. package/build/Release/.deps/Release/obj.target/multihashing/fugue.o.d +7 -0
  132. package/build/Release/.deps/Release/obj.target/multihashing/groestl.o.d +8 -0
  133. package/build/Release/.deps/Release/obj.target/multihashing/hefty1.o.d +12 -0
  134. package/build/Release/.deps/Release/obj.target/multihashing/keccak.o.d +8 -0
  135. package/build/Release/.deps/Release/obj.target/multihashing/multihashing.o.d +155 -0
  136. package/build/Release/.deps/Release/obj.target/multihashing/nist5.o.d +12 -0
  137. package/build/Release/.deps/Release/obj.target/multihashing/quark.o.d +14 -0
  138. package/build/Release/.deps/Release/obj.target/multihashing/qubit.o.d +12 -0
  139. package/build/Release/.deps/Release/obj.target/multihashing/scryptjane.o.d +30 -0
  140. package/build/Release/.deps/Release/obj.target/multihashing/scryptn.o.d +6 -0
  141. package/build/Release/.deps/Release/obj.target/multihashing/sha1.o.d +24 -0
  142. package/build/Release/.deps/Release/obj.target/multihashing/sha3/aes_helper.o.d +5 -0
  143. package/build/Release/.deps/Release/obj.target/multihashing/sha3/hamsi.o.d +7 -0
  144. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_blake.o.d +6 -0
  145. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_bmw.o.d +6 -0
  146. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_cubehash.o.d +6 -0
  147. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_echo.o.d +7 -0
  148. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_fugue.o.d +6 -0
  149. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_groestl.o.d +6 -0
  150. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_hefty1.o.d +5 -0
  151. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_jh.o.d +6 -0
  152. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_keccak.o.d +6 -0
  153. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_luffa.o.d +6 -0
  154. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_shabal.o.d +6 -0
  155. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_shavite.o.d +7 -0
  156. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_simd.o.d +6 -0
  157. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_skein.o.d +6 -0
  158. package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_whirlpool.o.d +8 -0
  159. package/build/Release/.deps/Release/obj.target/multihashing/shavite3.o.d +7 -0
  160. package/build/Release/.deps/Release/obj.target/multihashing/skein.o.d +8 -0
  161. package/build/Release/.deps/Release/obj.target/multihashing/x11.o.d +20 -0
  162. package/build/Release/.deps/Release/obj.target/multihashing/x13.o.d +23 -0
  163. package/build/Release/.deps/Release/obj.target/multihashing/x15.o.d +26 -0
  164. package/build/Release/.deps/Release/obj.target/multihashing.node.d +1 -0
  165. package/build/Release/multihashing.node +0 -0
  166. package/build/binding.Makefile +6 -0
  167. package/build/multihashing.target.mk +255 -0
  168. package/c11.c +85 -0
  169. package/c11.h +17 -0
  170. package/crypto/aesb.c +177 -0
  171. package/crypto/c_blake256.c +326 -0
  172. package/crypto/c_blake256.h +43 -0
  173. package/crypto/c_groestl.c +360 -0
  174. package/crypto/c_groestl.h +56 -0
  175. package/crypto/c_jh.c +367 -0
  176. package/crypto/c_jh.h +20 -0
  177. package/crypto/c_keccak.c +112 -0
  178. package/crypto/c_keccak.h +26 -0
  179. package/crypto/c_skein.c +2036 -0
  180. package/crypto/c_skein.h +45 -0
  181. package/crypto/crypto.h +186 -0
  182. package/crypto/cryptonote_core/account.cpp +50 -0
  183. package/crypto/cryptonote_core/account.h +61 -0
  184. package/crypto/cryptonote_core/cryptonote_basic_impl.cpp +186 -0
  185. package/crypto/cryptonote_core/cryptonote_basic_impl.h +65 -0
  186. package/crypto/cryptonote_core/cryptonote_format_utils.cpp +766 -0
  187. package/crypto/cryptonote_core/cryptonote_format_utils.h +30 -0
  188. package/crypto/cryptonote_protocol/cryptonote_protocol_defs.h +152 -0
  189. package/crypto/groestl_tables.h +38 -0
  190. package/crypto/hash-ops.h +57 -0
  191. package/crypto/hash.c +24 -0
  192. package/crypto/hash.h +22 -0
  193. package/crypto/int-util.h +230 -0
  194. package/crypto/oaes_config.h +50 -0
  195. package/crypto/oaes_lib.c +1468 -0
  196. package/crypto/oaes_lib.h +215 -0
  197. package/crypto/skein_port.h +190 -0
  198. package/crypto/variant2_int_sqrt.h +168 -0
  199. package/crypto/wild_keccak.cpp +119 -0
  200. package/crypto/wild_keccak.h +168 -0
  201. package/cryptonight.c +300 -0
  202. package/cryptonight.h +17 -0
  203. package/cryptonight_dark.c +300 -0
  204. package/cryptonight_dark.h +17 -0
  205. package/cryptonight_dark_lite.c +300 -0
  206. package/cryptonight_dark_lite.h +17 -0
  207. package/cryptonight_fast.c +300 -0
  208. package/cryptonight_fast.h +17 -0
  209. package/cryptonight_lite.c +300 -0
  210. package/cryptonight_lite.h +17 -0
  211. package/cryptonight_soft_shell.c +298 -0
  212. package/cryptonight_soft_shell.h +17 -0
  213. package/cryptonight_turtle.c +300 -0
  214. package/cryptonight_turtle.h +17 -0
  215. package/cryptonight_turtle_lite.c +300 -0
  216. package/cryptonight_turtle_lite.h +17 -0
  217. package/fresh.c +42 -0
  218. package/fresh.h +16 -0
  219. package/fugue.c +12 -0
  220. package/fugue.h +16 -0
  221. package/groestl.c +40 -0
  222. package/groestl.h +17 -0
  223. package/hefty1.c +63 -0
  224. package/hefty1.h +16 -0
  225. package/index.js +1 -0
  226. package/keccak.c +14 -0
  227. package/keccak.h +16 -0
  228. package/leocuvee-wrkzcoin-multi-hashing-0.0.20.tgz +0 -0
  229. package/multihashing.cc +699 -0
  230. package/nist5.c +46 -0
  231. package/nist5.h +16 -0
  232. package/package.json +56 -0
  233. package/quark.c +210 -0
  234. package/quark.h +16 -0
  235. package/qubit.c +45 -0
  236. package/qubit.h +16 -0
  237. package/scryptjane/scrypt-jane-chacha.h +132 -0
  238. package/scryptjane/scrypt-jane-hash.h +48 -0
  239. package/scryptjane/scrypt-jane-hash_keccak.h +168 -0
  240. package/scryptjane/scrypt-jane-hash_sha256.h +135 -0
  241. package/scryptjane/scrypt-jane-mix_chacha-avx.h +340 -0
  242. package/scryptjane/scrypt-jane-mix_chacha-sse2.h +371 -0
  243. package/scryptjane/scrypt-jane-mix_chacha-ssse3.h +348 -0
  244. package/scryptjane/scrypt-jane-mix_chacha.h +69 -0
  245. package/scryptjane/scrypt-jane-mix_salsa-avx.h +381 -0
  246. package/scryptjane/scrypt-jane-mix_salsa-sse2.h +443 -0
  247. package/scryptjane/scrypt-jane-mix_salsa.h +70 -0
  248. package/scryptjane/scrypt-jane-pbkdf2.h +112 -0
  249. package/scryptjane/scrypt-jane-portable-x86.h +364 -0
  250. package/scryptjane/scrypt-jane-portable.h +281 -0
  251. package/scryptjane/scrypt-jane-romix-basic.h +67 -0
  252. package/scryptjane/scrypt-jane-romix-template.h +118 -0
  253. package/scryptjane/scrypt-jane-romix.h +27 -0
  254. package/scryptjane/scrypt-jane-salsa.h +106 -0
  255. package/scryptjane/scrypt-jane-test-vectors.h +261 -0
  256. package/scryptjane.c +223 -0
  257. package/scryptjane.h +36 -0
  258. package/scryptn.c +258 -0
  259. package/scryptn.h +16 -0
  260. package/sha1.c +65 -0
  261. package/sha1.h +16 -0
  262. package/sha256.h +440 -0
  263. package/sha3/aes_helper.c +392 -0
  264. package/sha3/hamsi.c +867 -0
  265. package/sha3/hamsi_helper.c +39648 -0
  266. package/sha3/md_helper.c +347 -0
  267. package/sha3/sph_blake.c +1114 -0
  268. package/sha3/sph_blake.h +327 -0
  269. package/sha3/sph_bmw.c +965 -0
  270. package/sha3/sph_bmw.h +328 -0
  271. package/sha3/sph_cubehash.c +723 -0
  272. package/sha3/sph_cubehash.h +292 -0
  273. package/sha3/sph_echo.c +1031 -0
  274. package/sha3/sph_echo.h +320 -0
  275. package/sha3/sph_fugue.c +1208 -0
  276. package/sha3/sph_fugue.h +81 -0
  277. package/sha3/sph_groestl.c +3119 -0
  278. package/sha3/sph_groestl.h +329 -0
  279. package/sha3/sph_hamsi.h +321 -0
  280. package/sha3/sph_hefty1.c +378 -0
  281. package/sha3/sph_hefty1.h +66 -0
  282. package/sha3/sph_jh.c +1116 -0
  283. package/sha3/sph_jh.h +298 -0
  284. package/sha3/sph_keccak.c +1824 -0
  285. package/sha3/sph_keccak.h +293 -0
  286. package/sha3/sph_luffa.c +1426 -0
  287. package/sha3/sph_luffa.h +296 -0
  288. package/sha3/sph_shabal.c +806 -0
  289. package/sha3/sph_shabal.h +344 -0
  290. package/sha3/sph_shavite.c +1764 -0
  291. package/sha3/sph_shavite.h +314 -0
  292. package/sha3/sph_simd.c +1799 -0
  293. package/sha3/sph_simd.h +309 -0
  294. package/sha3/sph_skein.c +1254 -0
  295. package/sha3/sph_skein.h +298 -0
  296. package/sha3/sph_types.h +1976 -0
  297. package/sha3/sph_whirlpool.c +3480 -0
  298. package/sha3/sph_whirlpool.h +209 -0
  299. package/shavite3.c +24 -0
  300. package/shavite3.h +16 -0
  301. package/skein.c +26 -0
  302. package/skein.h +16 -0
  303. package/stdint.h +259 -0
  304. package/tests/argon2-tests.js +16 -0
  305. package/tests/benchmark.js +36 -0
  306. package/tests/cryptonight-tests.js +189 -0
  307. package/tests/cryptonight_monero.js +53 -0
  308. package/tests/test.js +16 -0
  309. package/x11.c +85 -0
  310. package/x11.h +16 -0
  311. package/x13.c +97 -0
  312. package/x13.h +5 -0
  313. package/x15.c +106 -0
  314. package/x15.h +16 -0
@@ -0,0 +1,297 @@
1
+ # Argon2
2
+
3
+ [![Build Status](https://travis-ci.org/P-H-C/phc-winner-argon2.svg?branch=master)](https://travis-ci.org/P-H-C/phc-winner-argon2)
4
+ [![Build status](https://ci.appveyor.com/api/projects/status/8nfwuwq55sgfkele?svg=true)](https://ci.appveyor.com/project/P-H-C/phc-winner-argon2)
5
+ [![codecov.io](https://codecov.io/github/P-H-C/phc-winner-argon2/coverage.svg?branch=master)](https://codecov.io/github/P-H-C/phc-winner-argon2?branch=master)
6
+
7
+ This is the reference C implementation of Argon2, the password-hashing
8
+ function that won the [Password Hashing Competition
9
+ (PHC)](https://password-hashing.net).
10
+
11
+ Argon2 is a password-hashing function that summarizes the state of the
12
+ art in the design of memory-hard functions and can be used to hash
13
+ passwords for credential storage, key derivation, or other applications.
14
+
15
+ It has a simple design aimed at the highest memory filling rate and
16
+ effective use of multiple computing units, while still providing defense
17
+ against tradeoff attacks (by exploiting the cache and memory organization
18
+ of the recent processors).
19
+
20
+ Argon2 has three variants: Argon2i, Argon2d, and Argon2id. Argon2d is faster
21
+ and uses data-depending memory access, which makes it highly resistant
22
+ against GPU cracking attacks and suitable for applications with no threats
23
+ from side-channel timing attacks (eg. cryptocurrencies). Argon2i instead
24
+ uses data-independent memory access, which is preferred for password
25
+ hashing and password-based key derivation, but it is slower as it makes
26
+ more passes over the memory to protect from tradeoff attacks. Argon2id is a
27
+ hybrid of Argon2i and Argon2d, using a combination of data-depending and
28
+ data-independent memory accesses, which gives some of Argon2i's resistance to
29
+ side-channel cache timing attacks and much of Argon2d's resistance to GPU
30
+ cracking attacks.
31
+
32
+ Argon2i, Argon2d, and Argon2id are parametrized by:
33
+
34
+ * A **time** cost, which defines the amount of computation realized and
35
+ therefore the execution time, given in number of iterations
36
+ * A **memory** cost, which defines the memory usage, given in kibibytes
37
+ * A **parallelism** degree, which defines the number of parallel threads
38
+
39
+ The [Argon2 document](argon2-specs.pdf) gives detailed specs and design
40
+ rationale.
41
+
42
+ Please report bugs as issues on this repository.
43
+
44
+ ## Usage
45
+
46
+ `make` builds the executable `argon2`, the static library `libargon2.a`,
47
+ and the shared library `libargon2.so` (or `libargon2.dylib` on OSX).
48
+ Make sure to run `make test` to verify that your build produces valid
49
+ results. `make install PREFIX=/usr` installs it to your system.
50
+
51
+ ### Command-line utility
52
+
53
+ `argon2` is a command-line utility to test specific Argon2 instances
54
+ on your system. To show usage instructions, run
55
+ `./argon2 -h` as
56
+ ```
57
+ Usage: ./argon2 [-h] salt [-i|-d|-id] [-t iterations] [-m memory] [-p parallelism] [-l hash length] [-e|-r] [-v (10|13)]
58
+ Password is read from stdin
59
+ Parameters:
60
+ salt The salt to use, at least 8 characters
61
+ -i Use Argon2i (this is the default)
62
+ -d Use Argon2d instead of Argon2i
63
+ -id Use Argon2id instead of Argon2i
64
+ -t N Sets the number of iterations to N (default = 3)
65
+ -m N Sets the memory usage of 2^N KiB (default 12)
66
+ -p N Sets parallelism to N threads (default 1)
67
+ -l N Sets hash output length to N bytes (default 32)
68
+ -e Output only encoded hash
69
+ -r Output only the raw bytes of the hash
70
+ -v (10|13) Argon2 version (defaults to the most recent version, currently 13)
71
+ -h Print argon2 usage
72
+ ```
73
+ For example, to hash "password" using "somesalt" as a salt and doing 2
74
+ iterations, consuming 64 MiB, using four parallel threads and an output hash
75
+ of 24 bytes
76
+ ```
77
+ $ echo -n "password" | ./argon2 somesalt -t 2 -m 16 -p 4 -l 24
78
+ Type: Argon2i
79
+ Iterations: 2
80
+ Memory: 65536 KiB
81
+ Parallelism: 4
82
+ Hash: 45d7ac72e76f242b20b77b9bf9bf9d5915894e669a24e6c6
83
+ Encoded: $argon2i$v=19$m=65536,t=2,p=4$c29tZXNhbHQ$RdescudvJCsgt3ub+b+dWRWJTmaaJObG
84
+ 0.188 seconds
85
+ Verification ok
86
+ ```
87
+
88
+ ### Library
89
+
90
+ `libargon2` provides an API to both low-level and high-level functions
91
+ for using Argon2.
92
+
93
+ The example program below hashes the string "password" with Argon2i
94
+ using the high-level API and then using the low-level API. While the
95
+ high-level API takes the three cost parameters (time, memory, and
96
+ parallelism), the password input buffer, the salt input buffer, and the
97
+ output buffers, the low-level API takes in these and additional parameters
98
+ , as defined in [`include/argon2.h`](include/argon2.h).
99
+
100
+ There are many additional parameters, but we will highlight three of them here.
101
+
102
+ 1. The `secret` parameter, which is used for [keyed hashing](
103
+ https://en.wikipedia.org/wiki/Hash-based_message_authentication_code).
104
+ This allows a secret key to be input at hashing time (from some external
105
+ location) and be folded into the value of the hash. This means that even if
106
+ your salts and hashes are compromized, an attacker cannot brute-force to find
107
+ the password without the key.
108
+
109
+ 2. The `ad` parameter, which is used to fold any additional data into the hash
110
+ value. Functionally, this behaves almost exactly like the `secret` or `salt`
111
+ parameters; the `ad` parameter is folding into the value of the hash.
112
+ However, this parameter is used for different data. The `salt` should be a
113
+ random string stored alongside your password. The `secret` should be a random
114
+ key only usable at hashing time. The `ad` is for any other data.
115
+
116
+ 3. The `flags` parameter, which determines which memory should be securely
117
+ erased. This is useful if you want to securly delete the `pwd` or `secret`
118
+ fields right after they are used. To do this set `flags` to either
119
+ `ARGON2_FLAG_CLEAR_PASSWORD` or `ARGON2_FLAG_CLEAR_SECRET`. To change how
120
+ internal memory is cleared, change the global flag
121
+ `FLAG_clear_internal_memory` (defaults to clearing internal memory).
122
+
123
+ Here the time cost `t_cost` is set to 2 iterations, the
124
+ memory cost `m_cost` is set to 2<sup>16</sup> kibibytes (64 mebibytes),
125
+ and parallelism is set to 1 (single-thread).
126
+
127
+ Compile for example as `gcc test.c libargon2.a -Isrc -o test`, if the program
128
+ below is named `test.c` and placed in the project's root directory.
129
+
130
+ ```c
131
+ #include "argon2.h"
132
+ #include <stdio.h>
133
+ #include <string.h>
134
+ #include <stdlib.h>
135
+
136
+ #define HASHLEN 32
137
+ #define SALTLEN 16
138
+ #define PWD "password"
139
+
140
+ int main(void)
141
+ {
142
+ uint8_t hash1[HASHLEN];
143
+ uint8_t hash2[HASHLEN];
144
+
145
+ uint8_t salt[SALTLEN];
146
+ memset( salt, 0x00, SALTLEN );
147
+
148
+ uint8_t *pwd = (uint8_t *)strdup(PWD);
149
+ uint32_t pwdlen = strlen((char *)pwd);
150
+
151
+ uint32_t t_cost = 2; // 1-pass computation
152
+ uint32_t m_cost = (1<<16); // 64 mebibytes memory usage
153
+ uint32_t parallelism = 1; // number of threads and lanes
154
+
155
+ // high-level API
156
+ argon2i_hash_raw(t_cost, m_cost, parallelism, pwd, pwdlen, salt, SALTLEN, hash1, HASHLEN);
157
+
158
+ // low-level API
159
+ argon2_context context = {
160
+ hash2, /* output array, at least HASHLEN in size */
161
+ HASHLEN, /* digest length */
162
+ pwd, /* password array */
163
+ pwdlen, /* password length */
164
+ salt, /* salt array */
165
+ SALTLEN, /* salt length */
166
+ NULL, 0, /* optional secret data */
167
+ NULL, 0, /* optional associated data */
168
+ t_cost, m_cost, parallelism, parallelism,
169
+ ARGON2_VERSION_13, /* algorithm version */
170
+ NULL, NULL, /* custom memory allocation / deallocation functions */
171
+ /* by default only internal memory is cleared (pwd is not wiped) */
172
+ ARGON2_DEFAULT_FLAGS
173
+ };
174
+
175
+ int rc = argon2i_ctx( &context );
176
+ if(ARGON2_OK != rc) {
177
+ printf("Error: %s\n", argon2_error_message(rc));
178
+ exit(1);
179
+ }
180
+ free(pwd);
181
+
182
+ for( int i=0; i<HASHLEN; ++i ) printf( "%02x", hash1[i] ); printf( "\n" );
183
+ if (memcmp(hash1, hash2, HASHLEN)) {
184
+ for( int i=0; i<HASHLEN; ++i ) {
185
+ printf( "%02x", hash2[i] );
186
+ }
187
+ printf("\nfail\n");
188
+ }
189
+ else printf("ok\n");
190
+ return 0;
191
+ }
192
+ ```
193
+
194
+ To use Argon2d instead of Argon2i call `argon2d_hash_raw` instead of
195
+ `argon2i_hash_raw` using the high-level API, and `argon2d` instead of
196
+ `argon2i` using the low-level API. Similarly for Argon2id, call `argon2id_hash_raw`
197
+ and `argon2id`.
198
+
199
+ To produce the crypt-like encoding rather than the raw hash, call
200
+ `argon2i_hash_encoded` for Argon2i, `argon2d_hash_encoded` for Argon2d, and
201
+ `argon2id_hash_encoded` for Argon2id
202
+
203
+ See [`include/argon2.h`](include/argon2.h) for API details.
204
+
205
+ *Note: in this example the salt is set to the all-`0x00` string for the
206
+ sake of simplicity, but in your application you should use a random salt.*
207
+
208
+
209
+ ### Benchmarks
210
+
211
+ `make bench` creates the executable `bench`, which measures the execution
212
+ time of various Argon2 instances:
213
+
214
+ ```
215
+ $ ./bench
216
+ Argon2d 1 iterations 1 MiB 1 threads: 5.91 cpb 5.91 Mcycles
217
+ Argon2i 1 iterations 1 MiB 1 threads: 4.64 cpb 4.64 Mcycles
218
+ 0.0041 seconds
219
+
220
+ Argon2d 1 iterations 1 MiB 2 threads: 2.76 cpb 2.76 Mcycles
221
+ Argon2i 1 iterations 1 MiB 2 threads: 2.87 cpb 2.87 Mcycles
222
+ 0.0038 seconds
223
+
224
+ Argon2d 1 iterations 1 MiB 4 threads: 3.25 cpb 3.25 Mcycles
225
+ Argon2i 1 iterations 1 MiB 4 threads: 3.57 cpb 3.57 Mcycles
226
+ 0.0048 seconds
227
+
228
+ (...)
229
+
230
+ Argon2d 1 iterations 4096 MiB 2 threads: 2.15 cpb 8788.08 Mcycles
231
+ Argon2i 1 iterations 4096 MiB 2 threads: 2.15 cpb 8821.59 Mcycles
232
+ 13.0112 seconds
233
+
234
+ Argon2d 1 iterations 4096 MiB 4 threads: 1.79 cpb 7343.72 Mcycles
235
+ Argon2i 1 iterations 4096 MiB 4 threads: 2.72 cpb 11124.86 Mcycles
236
+ 19.3974 seconds
237
+
238
+ (...)
239
+ ```
240
+
241
+ ## Bindings
242
+
243
+ Bindings are available for the following languages (make sure to read
244
+ their documentation):
245
+
246
+ * [Elixir](https://github.com/riverrun/argon2_elixir) by [@riverrun](https://github.com/riverrun)
247
+ * [Erlang](https://github.com/ergenius/eargon2) by [@ergenius](https://github.com/ergenius)
248
+ * [Go](https://github.com/tvdburgt/go-argon2) by [@tvdburgt](https://github.com/tvdburgt)
249
+ * [Haskell](https://hackage.haskell.org/package/argon2) by [@hvr](https://github.com/hvr)
250
+ * [JavaScript (native)](https://github.com/ranisalt/node-argon2), by [@ranisalt](https://github.com/ranisalt)
251
+ * [JavaScript (native)](https://github.com/jdconley/argon2themax), by [@jdconley](https://github.com/jdconley)
252
+ * [JavaScript (ffi)](https://github.com/cjlarose/argon2-ffi), by [@cjlarose](https://github.com/cjlarose)
253
+ * [JavaScript (browser)](https://github.com/antelle/argon2-browser), by [@antelle](https://github.com/antelle)
254
+ * [JVM](https://github.com/phxql/argon2-jvm) by [@phXql](https://github.com/phxql)
255
+ * [JVM (with keyed hashing)](https://github.com/kosprov/jargon2-api) by [@kosprov](https://github.com/kosprov)
256
+ * [Lua (native)](https://github.com/thibaultCha/lua-argon2) by [@thibaultCha](https://github.com/thibaultCha)
257
+ * [Lua (ffi)](https://github.com/thibaultCha/lua-argon2-ffi) by [@thibaultCha](https://github.com/thibaultCha)
258
+ * [OCaml](https://github.com/Khady/ocaml-argon2) by [@Khady](https://github.com/Khady)
259
+ * [Python (native)](https://pypi.python.org/pypi/argon2), by [@flamewow](https://github.com/flamewow)
260
+ * [Python (ffi)](https://pypi.python.org/pypi/argon2_cffi), by [@hynek](https://github.com/hynek)
261
+ * [Python (ffi, with keyed hashing)](https://github.com/thusoy/porridge), by [@thusoy](https://github.com/thusoy)
262
+ * [R](https://cran.r-project.org/package=argon2) by [@wrathematics](https://github.com/wrathematics)
263
+ * [Ruby](https://github.com/technion/ruby-argon2) by [@technion](https://github.com/technion)
264
+ * [Rust](https://github.com/quininer/argon2-rs) by [@quininer](https://github.com/quininer)
265
+ * [Rust](https://docs.rs/argonautica/) by [@bcmyers](https://github.com/bcmyers/)
266
+ * [C#/.NET CoreCLR](https://github.com/kmaragon/Konscious.Security.Cryptography) by [@kmaragon](https://github.com/kmaragon)
267
+ * [Perl](https://github.com/Leont/crypt-argon2) by [@leont](https://github.com/Leont)
268
+ * [mruby](https://github.com/Asmod4n/mruby-argon2) by [@Asmod4n](https://github.com/Asmod4n)
269
+ * [Swift](https://github.com/ImKcat/CatCrypto) by [@ImKcat](https://github.com/ImKcat)
270
+
271
+
272
+ ## Test suite
273
+
274
+ There are two sets of test suites. One is a low level test for the hash
275
+ function, the other tests the higher level API. Both of these are built and
276
+ executed by running:
277
+
278
+ `make test`
279
+
280
+ ## Intellectual property
281
+
282
+ Except for the components listed below, the Argon2 code in this
283
+ repository is copyright (c) 2015 Daniel Dinu, Dmitry Khovratovich (main
284
+ authors), Jean-Philippe Aumasson and Samuel Neves, and dual licensed under the
285
+ [CC0 License](https://creativecommons.org/about/cc0) and the
286
+ [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0). For more info
287
+ see the LICENSE file.
288
+
289
+ The string encoding routines in [`src/encoding.c`](src/encoding.c) are
290
+ copyright (c) 2015 Thomas Pornin, and under
291
+ [CC0 License](https://creativecommons.org/about/cc0).
292
+
293
+ The BLAKE2 code in [`src/blake2/`](src/blake2) is copyright (c) Samuel
294
+ Neves, 2013-2015, and under
295
+ [CC0 License](https://creativecommons.org/about/cc0).
296
+
297
+ All licenses are therefore GPL-compatible.
@@ -0,0 +1,40 @@
1
+ version: "{branch}-ci-{build}"
2
+
3
+ environment:
4
+ matrix:
5
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
6
+ CMAKE_GENERATOR: "Visual Studio 14 2015"
7
+ configuration: Debug
8
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
9
+ CMAKE_GENERATOR: "Visual Studio 14 2015"
10
+ configuration: RelWithDebInfo
11
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
12
+ CMAKE_GENERATOR: "Visual Studio 14 2015 Win64"
13
+ configuration: Debug
14
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
15
+ CMAKE_GENERATOR: "Visual Studio 14 2015 Win64"
16
+ configuration: RelWithDebInfo
17
+
18
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
19
+ CMAKE_GENERATOR: "Visual Studio 15 2017"
20
+ configuration: Debug
21
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
22
+ CMAKE_GENERATOR: "Visual Studio 15 2017"
23
+ configuration: RelWithDebInfo
24
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
25
+ CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
26
+ configuration: Debug
27
+ - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
28
+ CMAKE_GENERATOR: "Visual Studio 15 2017 Win64"
29
+ configuration: RelWithDebInfo
30
+
31
+ matrix:
32
+ fast_finish: false
33
+
34
+ build_script:
35
+ - ps: cmake --version
36
+ - ps: cmake -E make_directory "build-dir"
37
+ - ps: cmake -E chdir "build-dir" cmake -G "$($(Get-Item Env:CMAKE_GENERATOR).Value)" --config $env:configuration -DCMAKE_INSTALL_PREFIX="$($(get-location).Path)/root" ..
38
+ - ps: cmake --build "build-dir" --config $env:configuration
39
+ - ps: cd "build-dir"; ctest -V -C $env:configuration --build-run-dir "build-dir"; cd ..
40
+ - ps: cmake --build "build-dir" --target install --config $env:configuration
Binary file
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+
3
+ FILE="$(date "+%Y%m%d")"
4
+ BRANCH="master"
5
+
6
+ git archive --format zip --output "${FILE}.zip" "${BRANCH}"
7
+ git archive --format tar.gz --output "${FILE}.tar.gz" "${BRANCH}"