@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.
- package/.travis.yml +5 -0
- package/LICENSE +674 -0
- package/README.md +87 -0
- package/appveyor.yml +12 -0
- package/argon2/.gitattributes +10 -0
- package/argon2/.travis.yml +25 -0
- package/argon2/Argon2.sln +160 -0
- package/argon2/CHANGELOG.md +32 -0
- package/argon2/CMakeLists.txt +87 -0
- package/argon2/LICENSE +314 -0
- package/argon2/Makefile +196 -0
- package/argon2/README.md +297 -0
- package/argon2/appveyor.yml +40 -0
- package/argon2/argon2-specs.pdf +0 -0
- package/argon2/export.sh +7 -0
- package/argon2/include/argon2.h +427 -0
- package/argon2/latex/CMakeLists.txt +34 -0
- package/argon2/latex/IEEEtran.cls +6347 -0
- package/argon2/latex/Makefile +18 -0
- package/argon2/latex/argon2-specs.tex +920 -0
- package/argon2/latex/pics/argon2-par.pdf +0 -0
- package/argon2/latex/pics/compression.pdf +0 -0
- package/argon2/latex/pics/generic.pdf +0 -0
- package/argon2/latex/pics/power-distribution.jpg +0 -0
- package/argon2/latex/tradeoff.bib +822 -0
- package/argon2/libargon2.pc +16 -0
- package/argon2/man/CMakeLists.txt +8 -0
- package/argon2/man/argon2.1 +57 -0
- package/argon2/meson.build +16 -0
- package/argon2/meson_options.txt +1 -0
- package/argon2/src/CMakeLists.txt +147 -0
- package/argon2/src/argon2.c +452 -0
- package/argon2/src/argon2.pc.in +11 -0
- package/argon2/src/blake2/blake2-impl.h +156 -0
- package/argon2/src/blake2/blake2.h +89 -0
- package/argon2/src/blake2/blake2b.c +390 -0
- package/argon2/src/blake2/blamka-round-opt.h +471 -0
- package/argon2/src/blake2/blamka-round-ref.h +56 -0
- package/argon2/src/core.c +634 -0
- package/argon2/src/core.h +228 -0
- package/argon2/src/encoding.c +467 -0
- package/argon2/src/encoding.h +57 -0
- package/argon2/src/genkat.h +51 -0
- package/argon2/src/meson.build +68 -0
- package/argon2/src/opt.c +283 -0
- package/argon2/src/optimization/CMakeLists.txt +10 -0
- package/argon2/src/ref.c +194 -0
- package/argon2/src/thread.c +57 -0
- package/argon2/src/thread.h +67 -0
- package/argon2/tests/CMakeLists.txt +43 -0
- package/argon2/tests/bench.c +111 -0
- package/argon2/tests/genkat.c +207 -0
- package/argon2/tests/kats/argon2d +12304 -0
- package/argon2/tests/kats/argon2d.shasum +1 -0
- package/argon2/tests/kats/argon2d_v16 +12304 -0
- package/argon2/tests/kats/argon2d_v16.shasum +1 -0
- package/argon2/tests/kats/argon2i +12304 -0
- package/argon2/tests/kats/argon2i.shasum +1 -0
- package/argon2/tests/kats/argon2i_v16 +12304 -0
- package/argon2/tests/kats/argon2i_v16.shasum +1 -0
- package/argon2/tests/kats/argon2id +12304 -0
- package/argon2/tests/kats/argon2id.shasum +1 -0
- package/argon2/tests/kats/argon2id_v16 +12304 -0
- package/argon2/tests/kats/argon2id_v16.shasum +1 -0
- package/argon2/tests/kats/check-sums.ps1 +48 -0
- package/argon2/tests/kats/check-sums.sh +16 -0
- package/argon2/tests/kats/test.ps1 +132 -0
- package/argon2/tests/kats/test.sh +117 -0
- package/argon2/tests/meson.build +34 -0
- package/argon2/tests/test.c +289 -0
- package/argon2/tool/CMakeLists.txt +7 -0
- package/argon2/tool/main.c +339 -0
- package/argon2/tool/meson.build +8 -0
- package/argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj +226 -0
- package/argon2/vs2015/Argon2Opt/Argon2Opt.vcxproj.filters +69 -0
- package/argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj +226 -0
- package/argon2/vs2015/Argon2OptBench/Argon2OptBench.vcxproj.filters +69 -0
- package/argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj +225 -0
- package/argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj.filters +66 -0
- package/argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj +239 -0
- package/argon2/vs2015/Argon2OptGenKAT/Argon2OptGenKAT.vcxproj.filters +72 -0
- package/argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj +227 -0
- package/argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj.filters +69 -0
- package/argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj +226 -0
- package/argon2/vs2015/Argon2Ref/Argon2Ref.vcxproj.filters +69 -0
- package/argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj +226 -0
- package/argon2/vs2015/Argon2RefBench/Argon2RefBench.vcxproj.filters +69 -0
- package/argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj +225 -0
- package/argon2/vs2015/Argon2RefDll/Argon2RefDll.vcxproj.filters +66 -0
- package/argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj +227 -0
- package/argon2/vs2015/Argon2RefGenKAT/Argon2RefGenKAT.vcxproj.filters +72 -0
- package/argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj +226 -0
- package/argon2/vs2015/Argon2RefTestCI/Argon2RefTestCI.vcxproj.filters +69 -0
- package/bcrypt.c +566 -0
- package/bcrypt.h +14 -0
- package/binding.gyp +93 -0
- package/blake.c +17 -0
- package/blake.h +16 -0
- package/boolberry.cc +11 -0
- package/boolberry.h +6 -0
- package/build/Makefile +354 -0
- package/build/Release/.deps/Release/multihashing.node.d +1 -0
- package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/argon2.o.d +8 -0
- package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/blake2/blake2b.o.d +8 -0
- package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/core.o.d +10 -0
- package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/encoding.o.d +8 -0
- package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/ref.o.d +14 -0
- package/build/Release/.deps/Release/obj.target/multihashing/argon2/src/thread.o.d +5 -0
- package/build/Release/.deps/Release/obj.target/multihashing/bcrypt.o.d +4 -0
- package/build/Release/.deps/Release/obj.target/multihashing/blake.o.d +7 -0
- package/build/Release/.deps/Release/obj.target/multihashing/boolberry.o.d +12 -0
- package/build/Release/.deps/Release/obj.target/multihashing/c11.o.d +20 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/aesb.o.d +3 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_blake256.o.d +5 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_groestl.o.d +10 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_jh.o.d +9 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_keccak.o.d +7 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/c_skein.o.d +10 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/hash.o.d +7 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/oaes_lib.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/crypto/wild_keccak.o.d +8 -0
- package/build/Release/.deps/Release/obj.target/multihashing/cryptonight.o.d +18 -0
- package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_dark.o.d +18 -0
- package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_dark_lite.o.d +18 -0
- package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_fast.o.d +18 -0
- package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_lite.o.d +18 -0
- package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_soft_shell.o.d +18 -0
- package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_turtle.o.d +18 -0
- package/build/Release/.deps/Release/obj.target/multihashing/cryptonight_turtle_lite.o.d +18 -0
- package/build/Release/.deps/Release/obj.target/multihashing/fresh.o.d +10 -0
- package/build/Release/.deps/Release/obj.target/multihashing/fugue.o.d +7 -0
- package/build/Release/.deps/Release/obj.target/multihashing/groestl.o.d +8 -0
- package/build/Release/.deps/Release/obj.target/multihashing/hefty1.o.d +12 -0
- package/build/Release/.deps/Release/obj.target/multihashing/keccak.o.d +8 -0
- package/build/Release/.deps/Release/obj.target/multihashing/multihashing.o.d +155 -0
- package/build/Release/.deps/Release/obj.target/multihashing/nist5.o.d +12 -0
- package/build/Release/.deps/Release/obj.target/multihashing/quark.o.d +14 -0
- package/build/Release/.deps/Release/obj.target/multihashing/qubit.o.d +12 -0
- package/build/Release/.deps/Release/obj.target/multihashing/scryptjane.o.d +30 -0
- package/build/Release/.deps/Release/obj.target/multihashing/scryptn.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha1.o.d +24 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/aes_helper.o.d +5 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/hamsi.o.d +7 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_blake.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_bmw.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_cubehash.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_echo.o.d +7 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_fugue.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_groestl.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_hefty1.o.d +5 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_jh.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_keccak.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_luffa.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_shabal.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_shavite.o.d +7 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_simd.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_skein.o.d +6 -0
- package/build/Release/.deps/Release/obj.target/multihashing/sha3/sph_whirlpool.o.d +8 -0
- package/build/Release/.deps/Release/obj.target/multihashing/shavite3.o.d +7 -0
- package/build/Release/.deps/Release/obj.target/multihashing/skein.o.d +8 -0
- package/build/Release/.deps/Release/obj.target/multihashing/x11.o.d +20 -0
- package/build/Release/.deps/Release/obj.target/multihashing/x13.o.d +23 -0
- package/build/Release/.deps/Release/obj.target/multihashing/x15.o.d +26 -0
- package/build/Release/.deps/Release/obj.target/multihashing.node.d +1 -0
- package/build/Release/multihashing.node +0 -0
- package/build/binding.Makefile +6 -0
- package/build/multihashing.target.mk +255 -0
- package/c11.c +85 -0
- package/c11.h +17 -0
- package/crypto/aesb.c +177 -0
- package/crypto/c_blake256.c +326 -0
- package/crypto/c_blake256.h +43 -0
- package/crypto/c_groestl.c +360 -0
- package/crypto/c_groestl.h +56 -0
- package/crypto/c_jh.c +367 -0
- package/crypto/c_jh.h +20 -0
- package/crypto/c_keccak.c +112 -0
- package/crypto/c_keccak.h +26 -0
- package/crypto/c_skein.c +2036 -0
- package/crypto/c_skein.h +45 -0
- package/crypto/crypto.h +186 -0
- package/crypto/cryptonote_core/account.cpp +50 -0
- package/crypto/cryptonote_core/account.h +61 -0
- package/crypto/cryptonote_core/cryptonote_basic_impl.cpp +186 -0
- package/crypto/cryptonote_core/cryptonote_basic_impl.h +65 -0
- package/crypto/cryptonote_core/cryptonote_format_utils.cpp +766 -0
- package/crypto/cryptonote_core/cryptonote_format_utils.h +30 -0
- package/crypto/cryptonote_protocol/cryptonote_protocol_defs.h +152 -0
- package/crypto/groestl_tables.h +38 -0
- package/crypto/hash-ops.h +57 -0
- package/crypto/hash.c +24 -0
- package/crypto/hash.h +22 -0
- package/crypto/int-util.h +230 -0
- package/crypto/oaes_config.h +50 -0
- package/crypto/oaes_lib.c +1468 -0
- package/crypto/oaes_lib.h +215 -0
- package/crypto/skein_port.h +190 -0
- package/crypto/variant2_int_sqrt.h +168 -0
- package/crypto/wild_keccak.cpp +119 -0
- package/crypto/wild_keccak.h +168 -0
- package/cryptonight.c +300 -0
- package/cryptonight.h +17 -0
- package/cryptonight_dark.c +300 -0
- package/cryptonight_dark.h +17 -0
- package/cryptonight_dark_lite.c +300 -0
- package/cryptonight_dark_lite.h +17 -0
- package/cryptonight_fast.c +300 -0
- package/cryptonight_fast.h +17 -0
- package/cryptonight_lite.c +300 -0
- package/cryptonight_lite.h +17 -0
- package/cryptonight_soft_shell.c +298 -0
- package/cryptonight_soft_shell.h +17 -0
- package/cryptonight_turtle.c +300 -0
- package/cryptonight_turtle.h +17 -0
- package/cryptonight_turtle_lite.c +300 -0
- package/cryptonight_turtle_lite.h +17 -0
- package/fresh.c +42 -0
- package/fresh.h +16 -0
- package/fugue.c +12 -0
- package/fugue.h +16 -0
- package/groestl.c +40 -0
- package/groestl.h +17 -0
- package/hefty1.c +63 -0
- package/hefty1.h +16 -0
- package/index.js +1 -0
- package/keccak.c +14 -0
- package/keccak.h +16 -0
- package/leocuvee-wrkzcoin-multi-hashing-0.0.20.tgz +0 -0
- package/multihashing.cc +699 -0
- package/nist5.c +46 -0
- package/nist5.h +16 -0
- package/package.json +56 -0
- package/quark.c +210 -0
- package/quark.h +16 -0
- package/qubit.c +45 -0
- package/qubit.h +16 -0
- package/scryptjane/scrypt-jane-chacha.h +132 -0
- package/scryptjane/scrypt-jane-hash.h +48 -0
- package/scryptjane/scrypt-jane-hash_keccak.h +168 -0
- package/scryptjane/scrypt-jane-hash_sha256.h +135 -0
- package/scryptjane/scrypt-jane-mix_chacha-avx.h +340 -0
- package/scryptjane/scrypt-jane-mix_chacha-sse2.h +371 -0
- package/scryptjane/scrypt-jane-mix_chacha-ssse3.h +348 -0
- package/scryptjane/scrypt-jane-mix_chacha.h +69 -0
- package/scryptjane/scrypt-jane-mix_salsa-avx.h +381 -0
- package/scryptjane/scrypt-jane-mix_salsa-sse2.h +443 -0
- package/scryptjane/scrypt-jane-mix_salsa.h +70 -0
- package/scryptjane/scrypt-jane-pbkdf2.h +112 -0
- package/scryptjane/scrypt-jane-portable-x86.h +364 -0
- package/scryptjane/scrypt-jane-portable.h +281 -0
- package/scryptjane/scrypt-jane-romix-basic.h +67 -0
- package/scryptjane/scrypt-jane-romix-template.h +118 -0
- package/scryptjane/scrypt-jane-romix.h +27 -0
- package/scryptjane/scrypt-jane-salsa.h +106 -0
- package/scryptjane/scrypt-jane-test-vectors.h +261 -0
- package/scryptjane.c +223 -0
- package/scryptjane.h +36 -0
- package/scryptn.c +258 -0
- package/scryptn.h +16 -0
- package/sha1.c +65 -0
- package/sha1.h +16 -0
- package/sha256.h +440 -0
- package/sha3/aes_helper.c +392 -0
- package/sha3/hamsi.c +867 -0
- package/sha3/hamsi_helper.c +39648 -0
- package/sha3/md_helper.c +347 -0
- package/sha3/sph_blake.c +1114 -0
- package/sha3/sph_blake.h +327 -0
- package/sha3/sph_bmw.c +965 -0
- package/sha3/sph_bmw.h +328 -0
- package/sha3/sph_cubehash.c +723 -0
- package/sha3/sph_cubehash.h +292 -0
- package/sha3/sph_echo.c +1031 -0
- package/sha3/sph_echo.h +320 -0
- package/sha3/sph_fugue.c +1208 -0
- package/sha3/sph_fugue.h +81 -0
- package/sha3/sph_groestl.c +3119 -0
- package/sha3/sph_groestl.h +329 -0
- package/sha3/sph_hamsi.h +321 -0
- package/sha3/sph_hefty1.c +378 -0
- package/sha3/sph_hefty1.h +66 -0
- package/sha3/sph_jh.c +1116 -0
- package/sha3/sph_jh.h +298 -0
- package/sha3/sph_keccak.c +1824 -0
- package/sha3/sph_keccak.h +293 -0
- package/sha3/sph_luffa.c +1426 -0
- package/sha3/sph_luffa.h +296 -0
- package/sha3/sph_shabal.c +806 -0
- package/sha3/sph_shabal.h +344 -0
- package/sha3/sph_shavite.c +1764 -0
- package/sha3/sph_shavite.h +314 -0
- package/sha3/sph_simd.c +1799 -0
- package/sha3/sph_simd.h +309 -0
- package/sha3/sph_skein.c +1254 -0
- package/sha3/sph_skein.h +298 -0
- package/sha3/sph_types.h +1976 -0
- package/sha3/sph_whirlpool.c +3480 -0
- package/sha3/sph_whirlpool.h +209 -0
- package/shavite3.c +24 -0
- package/shavite3.h +16 -0
- package/skein.c +26 -0
- package/skein.h +16 -0
- package/stdint.h +259 -0
- package/tests/argon2-tests.js +16 -0
- package/tests/benchmark.js +36 -0
- package/tests/cryptonight-tests.js +189 -0
- package/tests/cryptonight_monero.js +53 -0
- package/tests/test.js +16 -0
- package/x11.c +85 -0
- package/x11.h +16 -0
- package/x13.c +97 -0
- package/x13.h +5 -0
- package/x15.c +106 -0
- package/x15.h +16 -0
package/nist5.c
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#include "nist5.h"
|
|
2
|
+
#include <stdlib.h>
|
|
3
|
+
#include <stdint.h>
|
|
4
|
+
#include <string.h>
|
|
5
|
+
#include <stdio.h>
|
|
6
|
+
|
|
7
|
+
#include "sha3/sph_blake.h"
|
|
8
|
+
#include "sha3/sph_groestl.h"
|
|
9
|
+
#include "sha3/sph_jh.h"
|
|
10
|
+
#include "sha3/sph_keccak.h"
|
|
11
|
+
#include "sha3/sph_skein.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
void nist5_hash(const char* input, char* output, uint32_t len)
|
|
15
|
+
{
|
|
16
|
+
sph_blake512_context ctx_blake;
|
|
17
|
+
sph_groestl512_context ctx_groestl;
|
|
18
|
+
sph_skein512_context ctx_skein;
|
|
19
|
+
sph_jh512_context ctx_jh;
|
|
20
|
+
sph_keccak512_context ctx_keccak;
|
|
21
|
+
|
|
22
|
+
//these uint512 in the c++ source of the client are backed by an array of uint32
|
|
23
|
+
uint32_t hash[16];
|
|
24
|
+
|
|
25
|
+
sph_blake512_init(&ctx_blake);
|
|
26
|
+
sph_blake512 (&ctx_blake, input, len);
|
|
27
|
+
sph_blake512_close (&ctx_blake, hash);
|
|
28
|
+
|
|
29
|
+
sph_groestl512_init(&ctx_groestl);
|
|
30
|
+
sph_groestl512 (&ctx_groestl, hash, 64);
|
|
31
|
+
sph_groestl512_close(&ctx_groestl, hash);
|
|
32
|
+
|
|
33
|
+
sph_jh512_init(&ctx_jh);
|
|
34
|
+
sph_jh512 (&ctx_jh, hash, 64);
|
|
35
|
+
sph_jh512_close(&ctx_jh, hash);
|
|
36
|
+
|
|
37
|
+
sph_keccak512_init(&ctx_keccak);
|
|
38
|
+
sph_keccak512 (&ctx_keccak, hash, 64);
|
|
39
|
+
sph_keccak512_close(&ctx_keccak, hash);
|
|
40
|
+
|
|
41
|
+
sph_skein512_init(&ctx_skein);
|
|
42
|
+
sph_skein512 (&ctx_skein, hash, 64);
|
|
43
|
+
sph_skein512_close (&ctx_skein, hash);
|
|
44
|
+
|
|
45
|
+
memcpy(output, hash, 32);
|
|
46
|
+
}
|
package/nist5.h
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leocuvee/wrkzcoin-multi-hashing",
|
|
3
|
+
"version": "0.0.20",
|
|
4
|
+
"main": "multihashing",
|
|
5
|
+
"gypfile": true,
|
|
6
|
+
"author": "Matthew Little <zone117x@gmail.com>",
|
|
7
|
+
"contributors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Wrkz Team",
|
|
10
|
+
"email": "team@wrkz.work",
|
|
11
|
+
"url": "https://www.wrkz.work"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "Leo Stehlik not associated with any bloody crypto project"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"license": "GPL-3.0",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/derogold/wrkzcoin-multi-hashing.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "node-gyp clean && node-gyp configure && node-gyp build && node tests/cryptonight-tests.js && node tests/argon2-tests.js",
|
|
24
|
+
"install": "node-gyp rebuild"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"bindings": "^1.5.0",
|
|
28
|
+
"safe-buffer": "^5.1.2"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"scrypt",
|
|
32
|
+
"scryptjane",
|
|
33
|
+
"script-n",
|
|
34
|
+
"x11",
|
|
35
|
+
"quark",
|
|
36
|
+
"keccak_hash",
|
|
37
|
+
"skein",
|
|
38
|
+
"bcrypt",
|
|
39
|
+
"keccak",
|
|
40
|
+
"blake",
|
|
41
|
+
"shavite",
|
|
42
|
+
"fugue",
|
|
43
|
+
"sha1",
|
|
44
|
+
"turtlecoin",
|
|
45
|
+
"wrkzcoin",
|
|
46
|
+
"cryptonight"
|
|
47
|
+
],
|
|
48
|
+
"description": "Cryptocurrency hashing functions for NodeJS. Adapted to be used with DeroGold and WRKZCoin. Used as a dependency for nodejs pool.",
|
|
49
|
+
"directories": {
|
|
50
|
+
"test": "tests"
|
|
51
|
+
},
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/derogold/wrkzcoin-multi-hashing/issues"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://github.com/derogold/wrkzcoin-multi-hashing#readme"
|
|
56
|
+
}
|
package/quark.c
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/*-
|
|
2
|
+
* Copyright 2009 Colin Percival, 2011 ArtForz, 2013 Neisklar,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
|
6
|
+
* modification, are permitted provided that the following conditions
|
|
7
|
+
* are met:
|
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
|
13
|
+
*
|
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
15
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
16
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
17
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
18
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
19
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
20
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
21
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
22
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
23
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
24
|
+
* SUCH DAMAGE.
|
|
25
|
+
*
|
|
26
|
+
* This file was originally written by Colin Percival as part of the Tarsnap
|
|
27
|
+
* online backup system.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#include "quark.h"
|
|
31
|
+
#include <stdlib.h>
|
|
32
|
+
#include <stdint.h>
|
|
33
|
+
#include <string.h>
|
|
34
|
+
#include <stdio.h>
|
|
35
|
+
#include "sha3/sph_blake.h"
|
|
36
|
+
#include "sha3/sph_bmw.h"
|
|
37
|
+
#include "sha3/sph_groestl.h"
|
|
38
|
+
#include "sha3/sph_jh.h"
|
|
39
|
+
#include "sha3/sph_keccak.h"
|
|
40
|
+
#include "sha3/sph_skein.h"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
static __inline uint32_t
|
|
44
|
+
be32dec(const void *pp)
|
|
45
|
+
{
|
|
46
|
+
const uint8_t *p = (uint8_t const *)pp;
|
|
47
|
+
|
|
48
|
+
return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) +
|
|
49
|
+
((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static __inline void
|
|
53
|
+
be32enc(void *pp, uint32_t x)
|
|
54
|
+
{
|
|
55
|
+
uint8_t * p = (uint8_t *)pp;
|
|
56
|
+
|
|
57
|
+
p[3] = x & 0xff;
|
|
58
|
+
p[2] = (x >> 8) & 0xff;
|
|
59
|
+
p[1] = (x >> 16) & 0xff;
|
|
60
|
+
p[0] = (x >> 24) & 0xff;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static __inline uint32_t
|
|
64
|
+
le32dec(const void *pp)
|
|
65
|
+
{
|
|
66
|
+
const uint8_t *p = (uint8_t const *)pp;
|
|
67
|
+
|
|
68
|
+
return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
|
|
69
|
+
((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static __inline void
|
|
73
|
+
le32enc(void *pp, uint32_t x)
|
|
74
|
+
{
|
|
75
|
+
uint8_t * p = (uint8_t *)pp;
|
|
76
|
+
|
|
77
|
+
p[0] = x & 0xff;
|
|
78
|
+
p[1] = (x >> 8) & 0xff;
|
|
79
|
+
p[2] = (x >> 16) & 0xff;
|
|
80
|
+
p[3] = (x >> 24) & 0xff;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
* Encode a length len/4 vector of (uint32_t) into a length len vector of
|
|
85
|
+
* (unsigned char) in big-endian form. Assumes len is a multiple of 4.
|
|
86
|
+
*/
|
|
87
|
+
static void
|
|
88
|
+
be32enc_vect(unsigned char *dst, const uint32_t *src, uint32_t len)
|
|
89
|
+
{
|
|
90
|
+
size_t i;
|
|
91
|
+
|
|
92
|
+
for (i = 0; i < len / 4; i++)
|
|
93
|
+
be32enc(dst + i * 4, src[i]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
* Decode a big-endian length len vector of (unsigned char) into a length
|
|
98
|
+
* len/4 vector of (uint32_t). Assumes len is a multiple of 4.
|
|
99
|
+
*/
|
|
100
|
+
static void
|
|
101
|
+
be32dec_vect(uint32_t *dst, const unsigned char *src, uint32_t len)
|
|
102
|
+
{
|
|
103
|
+
size_t i;
|
|
104
|
+
|
|
105
|
+
for (i = 0; i < len / 4; i++)
|
|
106
|
+
dst[i] = be32dec(src + i * 4);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
void quark_hash(const char* input, char* output, uint32_t len)
|
|
110
|
+
{
|
|
111
|
+
sph_blake512_context ctx_blake;
|
|
112
|
+
sph_bmw512_context ctx_bmw;
|
|
113
|
+
sph_groestl512_context ctx_groestl;
|
|
114
|
+
sph_jh512_context ctx_jh;
|
|
115
|
+
sph_keccak512_context ctx_keccak;
|
|
116
|
+
sph_skein512_context ctx_skein;
|
|
117
|
+
|
|
118
|
+
uint32_t mask = 8;
|
|
119
|
+
uint32_t zero = 0;
|
|
120
|
+
|
|
121
|
+
uint32_t hashA[16], hashB[16];
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
sph_blake512_init(&ctx_blake);
|
|
126
|
+
sph_blake512 (&ctx_blake, input, len);
|
|
127
|
+
sph_blake512_close (&ctx_blake, hashA); //0
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
sph_bmw512_init(&ctx_bmw);
|
|
131
|
+
sph_bmw512 (&ctx_bmw, hashA, 64); //0
|
|
132
|
+
sph_bmw512_close(&ctx_bmw, hashB); //1
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
if ((hashB[0] & mask) != zero) //1
|
|
136
|
+
{
|
|
137
|
+
sph_groestl512_init(&ctx_groestl);
|
|
138
|
+
sph_groestl512 (&ctx_groestl, hashB, 64); //1
|
|
139
|
+
sph_groestl512_close(&ctx_groestl, hashA); //2
|
|
140
|
+
}
|
|
141
|
+
else
|
|
142
|
+
{
|
|
143
|
+
sph_skein512_init(&ctx_skein);
|
|
144
|
+
sph_skein512 (&ctx_skein, hashB, 64); //1
|
|
145
|
+
sph_skein512_close(&ctx_skein, hashA); //2
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
sph_groestl512_init(&ctx_groestl);
|
|
150
|
+
sph_groestl512 (&ctx_groestl, hashA, 64); //2
|
|
151
|
+
sph_groestl512_close(&ctx_groestl, hashB); //3
|
|
152
|
+
|
|
153
|
+
sph_jh512_init(&ctx_jh);
|
|
154
|
+
sph_jh512 (&ctx_jh, hashB, 64); //3
|
|
155
|
+
sph_jh512_close(&ctx_jh, hashA); //4
|
|
156
|
+
|
|
157
|
+
if ((hashA[0] & mask) != zero) //4
|
|
158
|
+
{
|
|
159
|
+
sph_blake512_init(&ctx_blake);
|
|
160
|
+
sph_blake512 (&ctx_blake, hashA, 64); //
|
|
161
|
+
sph_blake512_close(&ctx_blake, hashB); //5
|
|
162
|
+
}
|
|
163
|
+
else
|
|
164
|
+
{
|
|
165
|
+
sph_bmw512_init(&ctx_bmw);
|
|
166
|
+
sph_bmw512 (&ctx_bmw, hashA, 64); //4
|
|
167
|
+
sph_bmw512_close(&ctx_bmw, hashB); //5
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
sph_keccak512_init(&ctx_keccak);
|
|
171
|
+
sph_keccak512 (&ctx_keccak,hashB, 64); //5
|
|
172
|
+
sph_keccak512_close(&ctx_keccak, hashA); //6
|
|
173
|
+
|
|
174
|
+
sph_skein512_init(&ctx_skein);
|
|
175
|
+
sph_skein512 (&ctx_skein, hashA, 64); //6
|
|
176
|
+
sph_skein512_close(&ctx_skein, hashB); //7
|
|
177
|
+
|
|
178
|
+
if ((hashB[0] & mask) != zero) //7
|
|
179
|
+
{
|
|
180
|
+
sph_keccak512_init(&ctx_keccak);
|
|
181
|
+
sph_keccak512 (&ctx_keccak, hashB, 64); //
|
|
182
|
+
sph_keccak512_close(&ctx_keccak, hashA); //8
|
|
183
|
+
}
|
|
184
|
+
else
|
|
185
|
+
{
|
|
186
|
+
sph_jh512_init(&ctx_jh);
|
|
187
|
+
sph_jh512 (&ctx_jh, hashB, 64); //7
|
|
188
|
+
sph_jh512_close(&ctx_jh, hashA); //8
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
memcpy(output, hashA, 32);
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
/*
|
|
197
|
+
printf("result: ");
|
|
198
|
+
for (ii=0; ii < 32; ii++)
|
|
199
|
+
{
|
|
200
|
+
printf ("%.2x",((uint8_t*)output)[ii]);
|
|
201
|
+
}
|
|
202
|
+
printf ("\n");
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
|
package/quark.h
ADDED
package/qubit.c
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#include "qubit.h"
|
|
2
|
+
|
|
3
|
+
#include <string.h>
|
|
4
|
+
#include <stdlib.h>
|
|
5
|
+
|
|
6
|
+
#include "sha3/sph_cubehash.h"
|
|
7
|
+
#include "sha3/sph_luffa.h"
|
|
8
|
+
#include "sha3/sph_shavite.h"
|
|
9
|
+
#include "sha3/sph_simd.h"
|
|
10
|
+
#include "sha3/sph_echo.h"
|
|
11
|
+
|
|
12
|
+
void qubit_hash(const char* input, char* output, uint32_t len)
|
|
13
|
+
{
|
|
14
|
+
sph_luffa512_context ctx_luffa;
|
|
15
|
+
sph_cubehash512_context ctx_cubehash;
|
|
16
|
+
sph_shavite512_context ctx_shavite;
|
|
17
|
+
sph_simd512_context ctx_simd;
|
|
18
|
+
sph_echo512_context ctx_echo;
|
|
19
|
+
|
|
20
|
+
char hash1[64];
|
|
21
|
+
char hash2[64];
|
|
22
|
+
|
|
23
|
+
sph_luffa512_init(&ctx_luffa);
|
|
24
|
+
sph_luffa512(&ctx_luffa, (const void*) input, len);
|
|
25
|
+
sph_luffa512_close(&ctx_luffa, (void*) &hash1); // 1
|
|
26
|
+
|
|
27
|
+
sph_cubehash512_init(&ctx_cubehash);
|
|
28
|
+
sph_cubehash512(&ctx_cubehash, (const void*) &hash1, 64); // 1
|
|
29
|
+
sph_cubehash512_close(&ctx_cubehash, (void*) &hash2); // 2
|
|
30
|
+
|
|
31
|
+
sph_shavite512_init(&ctx_shavite);
|
|
32
|
+
sph_shavite512(&ctx_shavite, (const void*) &hash2, 64); // 3
|
|
33
|
+
sph_shavite512_close(&ctx_shavite, (void*) &hash1); // 4
|
|
34
|
+
|
|
35
|
+
sph_simd512_init(&ctx_simd);
|
|
36
|
+
sph_simd512(&ctx_simd, (const void*) &hash1, 64); // 4
|
|
37
|
+
sph_simd512_close(&ctx_simd, (void*) &hash2); // 5
|
|
38
|
+
|
|
39
|
+
sph_echo512_init(&ctx_echo);
|
|
40
|
+
sph_echo512(&ctx_echo, (const void*) &hash2, 64); // 5
|
|
41
|
+
sph_echo512_close(&ctx_echo, (void*) &hash1); // 6
|
|
42
|
+
|
|
43
|
+
memcpy(output, &hash1, 32);
|
|
44
|
+
}
|
|
45
|
+
|
package/qubit.h
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#define SCRYPT_MIX_BASE "ChaCha20/8"
|
|
2
|
+
|
|
3
|
+
typedef uint32_t scrypt_mix_word_t;
|
|
4
|
+
|
|
5
|
+
#define SCRYPT_WORDTO8_LE U32TO8_LE
|
|
6
|
+
#define SCRYPT_WORD_ENDIAN_SWAP U32_SWAP
|
|
7
|
+
|
|
8
|
+
#define SCRYPT_BLOCK_BYTES 64
|
|
9
|
+
#define SCRYPT_BLOCK_WORDS (SCRYPT_BLOCK_BYTES / sizeof(scrypt_mix_word_t))
|
|
10
|
+
|
|
11
|
+
/* must have these here in case block bytes is ever != 64 */
|
|
12
|
+
#include "scrypt-jane-romix-basic.h"
|
|
13
|
+
|
|
14
|
+
#include "scrypt-jane-mix_chacha-avx.h"
|
|
15
|
+
#include "scrypt-jane-mix_chacha-ssse3.h"
|
|
16
|
+
#include "scrypt-jane-mix_chacha-sse2.h"
|
|
17
|
+
#include "scrypt-jane-mix_chacha.h"
|
|
18
|
+
|
|
19
|
+
#if defined(SCRYPT_CHACHA_AVX)
|
|
20
|
+
#define SCRYPT_CHUNKMIX_FN scrypt_ChunkMix_avx
|
|
21
|
+
#define SCRYPT_ROMIX_FN scrypt_ROMix_avx
|
|
22
|
+
#define SCRYPT_MIX_FN chacha_core_avx
|
|
23
|
+
#define SCRYPT_ROMIX_TANGLE_FN scrypt_romix_nop
|
|
24
|
+
#define SCRYPT_ROMIX_UNTANGLE_FN scrypt_romix_nop
|
|
25
|
+
#include "scrypt-jane-romix-template.h"
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#if defined(SCRYPT_CHACHA_SSSE3)
|
|
29
|
+
#define SCRYPT_CHUNKMIX_FN scrypt_ChunkMix_ssse3
|
|
30
|
+
#define SCRYPT_ROMIX_FN scrypt_ROMix_ssse3
|
|
31
|
+
#define SCRYPT_MIX_FN chacha_core_ssse3
|
|
32
|
+
#define SCRYPT_ROMIX_TANGLE_FN scrypt_romix_nop
|
|
33
|
+
#define SCRYPT_ROMIX_UNTANGLE_FN scrypt_romix_nop
|
|
34
|
+
#include "scrypt-jane-romix-template.h"
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
#if defined(SCRYPT_CHACHA_SSE2)
|
|
38
|
+
#define SCRYPT_CHUNKMIX_FN scrypt_ChunkMix_sse2
|
|
39
|
+
#define SCRYPT_ROMIX_FN scrypt_ROMix_sse2
|
|
40
|
+
#define SCRYPT_MIX_FN chacha_core_sse2
|
|
41
|
+
#define SCRYPT_ROMIX_TANGLE_FN scrypt_romix_nop
|
|
42
|
+
#define SCRYPT_ROMIX_UNTANGLE_FN scrypt_romix_nop
|
|
43
|
+
#include "scrypt-jane-romix-template.h"
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
/* cpu agnostic */
|
|
47
|
+
#define SCRYPT_ROMIX_FN scrypt_ROMix_basic
|
|
48
|
+
#define SCRYPT_MIX_FN chacha_core_basic
|
|
49
|
+
#define SCRYPT_ROMIX_TANGLE_FN scrypt_romix_convert_endian
|
|
50
|
+
#define SCRYPT_ROMIX_UNTANGLE_FN scrypt_romix_convert_endian
|
|
51
|
+
#include "scrypt-jane-romix-template.h"
|
|
52
|
+
|
|
53
|
+
#if !defined(SCRYPT_CHOOSE_COMPILETIME)
|
|
54
|
+
static scrypt_ROMixfn
|
|
55
|
+
scrypt_getROMix() {
|
|
56
|
+
size_t cpuflags = detect_cpu();
|
|
57
|
+
|
|
58
|
+
#if defined(SCRYPT_CHACHA_AVX)
|
|
59
|
+
if (cpuflags & cpu_avx)
|
|
60
|
+
return scrypt_ROMix_avx;
|
|
61
|
+
else
|
|
62
|
+
#endif
|
|
63
|
+
|
|
64
|
+
#if defined(SCRYPT_CHACHA_SSSE3)
|
|
65
|
+
if (cpuflags & cpu_ssse3)
|
|
66
|
+
return scrypt_ROMix_ssse3;
|
|
67
|
+
else
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
#if defined(SCRYPT_CHACHA_SSE2)
|
|
71
|
+
if (cpuflags & cpu_sse2)
|
|
72
|
+
return scrypt_ROMix_sse2;
|
|
73
|
+
else
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
return scrypt_ROMix_basic;
|
|
77
|
+
}
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
#if defined(SCRYPT_TEST_SPEED)
|
|
82
|
+
static size_t
|
|
83
|
+
available_implementations() {
|
|
84
|
+
size_t flags = 0;
|
|
85
|
+
|
|
86
|
+
#if defined(SCRYPT_CHACHA_AVX)
|
|
87
|
+
flags |= cpu_avx;
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
#if defined(SCRYPT_CHACHA_SSSE3)
|
|
91
|
+
flags |= cpu_ssse3;
|
|
92
|
+
#endif
|
|
93
|
+
|
|
94
|
+
#if defined(SCRYPT_CHACHA_SSE2)
|
|
95
|
+
flags |= cpu_sse2;
|
|
96
|
+
#endif
|
|
97
|
+
|
|
98
|
+
return flags;
|
|
99
|
+
}
|
|
100
|
+
#endif
|
|
101
|
+
|
|
102
|
+
static int
|
|
103
|
+
scrypt_test_mix() {
|
|
104
|
+
static const uint8_t expected[16] = {
|
|
105
|
+
0x48,0x2b,0x2d,0xb8,0xa1,0x33,0x22,0x73,0xcd,0x16,0xc4,0xb4,0xb0,0x7f,0xb1,0x8a,
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
int ret = 1;
|
|
109
|
+
size_t cpuflags = detect_cpu();
|
|
110
|
+
|
|
111
|
+
#if defined(SCRYPT_CHACHA_AVX)
|
|
112
|
+
if (cpuflags & cpu_avx)
|
|
113
|
+
ret &= scrypt_test_mix_instance(scrypt_ChunkMix_avx, scrypt_romix_nop, scrypt_romix_nop, expected);
|
|
114
|
+
#endif
|
|
115
|
+
|
|
116
|
+
#if defined(SCRYPT_CHACHA_SSSE3)
|
|
117
|
+
if (cpuflags & cpu_ssse3)
|
|
118
|
+
ret &= scrypt_test_mix_instance(scrypt_ChunkMix_ssse3, scrypt_romix_nop, scrypt_romix_nop, expected);
|
|
119
|
+
#endif
|
|
120
|
+
|
|
121
|
+
#if defined(SCRYPT_CHACHA_SSE2)
|
|
122
|
+
if (cpuflags & cpu_sse2)
|
|
123
|
+
ret &= scrypt_test_mix_instance(scrypt_ChunkMix_sse2, scrypt_romix_nop, scrypt_romix_nop, expected);
|
|
124
|
+
#endif
|
|
125
|
+
|
|
126
|
+
#if defined(SCRYPT_CHACHA_BASIC)
|
|
127
|
+
ret &= scrypt_test_mix_instance(scrypt_ChunkMix_basic, scrypt_romix_convert_endian, scrypt_romix_convert_endian, expected);
|
|
128
|
+
#endif
|
|
129
|
+
|
|
130
|
+
return ret;
|
|
131
|
+
}
|
|
132
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#if defined(SCRYPT_BLAKE512)
|
|
2
|
+
#include "scrypt-jane-hash_blake512.h"
|
|
3
|
+
#elif defined(SCRYPT_BLAKE256)
|
|
4
|
+
#include "scrypt-jane-hash_blake256.h"
|
|
5
|
+
#elif defined(SCRYPT_SHA512)
|
|
6
|
+
#include "scrypt-jane-hash_sha512.h"
|
|
7
|
+
#elif defined(SCRYPT_SHA256)
|
|
8
|
+
#include "scrypt-jane-hash_sha256.h"
|
|
9
|
+
#elif defined(SCRYPT_SKEIN512)
|
|
10
|
+
#include "scrypt-jane-hash_skein512.h"
|
|
11
|
+
#elif defined(SCRYPT_KECCAK512) || defined(SCRYPT_KECCAK256)
|
|
12
|
+
#include "scrypt-jane-hash_keccak.h"
|
|
13
|
+
#else
|
|
14
|
+
#define SCRYPT_HASH "ERROR"
|
|
15
|
+
#define SCRYPT_HASH_BLOCK_SIZE 64
|
|
16
|
+
#define SCRYPT_HASH_DIGEST_SIZE 64
|
|
17
|
+
typedef struct scrypt_hash_state_t { size_t dummy; } scrypt_hash_state;
|
|
18
|
+
typedef uint8_t scrypt_hash_digest[SCRYPT_HASH_DIGEST_SIZE];
|
|
19
|
+
static void scrypt_hash_init(scrypt_hash_state *S) {}
|
|
20
|
+
static void scrypt_hash_update(scrypt_hash_state *S, const uint8_t *in, size_t inlen) {}
|
|
21
|
+
static void scrypt_hash_finish(scrypt_hash_state *S, uint8_t *hash) {}
|
|
22
|
+
static const uint8_t scrypt_test_hash_expected[SCRYPT_HASH_DIGEST_SIZE] = {0};
|
|
23
|
+
#error must define a hash function!
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
#include "scrypt-jane-pbkdf2.h"
|
|
27
|
+
|
|
28
|
+
#define SCRYPT_TEST_HASH_LEN 257 /* (2 * largest block size) + 1 */
|
|
29
|
+
|
|
30
|
+
static int
|
|
31
|
+
scrypt_test_hash() {
|
|
32
|
+
scrypt_hash_state st;
|
|
33
|
+
scrypt_hash_digest hash, final;
|
|
34
|
+
uint8_t msg[SCRYPT_TEST_HASH_LEN];
|
|
35
|
+
size_t i;
|
|
36
|
+
|
|
37
|
+
for (i = 0; i < SCRYPT_TEST_HASH_LEN; i++)
|
|
38
|
+
msg[i] = (uint8_t)i;
|
|
39
|
+
|
|
40
|
+
scrypt_hash_init(&st);
|
|
41
|
+
for (i = 0; i < SCRYPT_TEST_HASH_LEN + 1; i++) {
|
|
42
|
+
scrypt_hash(hash, msg, i);
|
|
43
|
+
scrypt_hash_update(&st, hash, sizeof(hash));
|
|
44
|
+
}
|
|
45
|
+
scrypt_hash_finish(&st, final);
|
|
46
|
+
return scrypt_verify(final, scrypt_test_hash_expected, SCRYPT_HASH_DIGEST_SIZE);
|
|
47
|
+
}
|
|
48
|
+
|